To create Kramdown-style attribute lists for adding HTML classes around blocks of Markdown, you can leverage Hugo shortcodes.
-
Add the following to
layouts/shortcodes/wrap.html
:<div class="{{ range .Params }}{{ . }} {{ end }}"> {{ .Inner }} </div>
-
In your page, use the shortcode, and pass the class names.
{{% wrap "outer-class" anotherclass %}} This is the inner text. {{% /wrap %}}
The resulting HTML should be
<div class="outer-class anotherclass ">
<p>
This is the inner text.
</p>
</div>