Add CSS Classes to Markdown in Hugo

Append a CSS class in curly brackets {.class} immediately following a heading OR on the next line after a markdown block to apply a specific class attribute without having to actually write in HTML.

Example

## hello {.article-metadata} - this snippet renders the below:

References

  1. https://gohugo.io/getting-started/configuration-markup/#goldmark
  2. https://github.com/yuin/goldmark/#built-in-extensions

Related