Raw HTML in Markdown
Drop in arbitrary markup when Markdown isn't enough.
Raw HTML in Markdown
Hugo’s Goldmark renderer escapes or strips some raw HTML by default. The
html shortcode passes its inner content through safeHTML, letting you
embed any HTML you need without changing site-wide Markdown settings.
Example
Note: This alert block is raw HTML, rendered inside a
Markdown page through the
html shortcode.Source
{{< html >}}
<div class="alert alert-info">
<strong>Note:</strong> This alert block is raw HTML, rendered inside a
Markdown page through the <code>html</code> shortcode.
</div>
{{< /html >}}
When to use it
Reach for html when the markup you want isn’t expressible in Markdown: a
wrapper with custom classes, a semantic element like <aside>, or a
specific Bootstrap component. For repeated patterns, prefer a dedicated
shortcode or partial.