Can I customized HTML produced from Markdown?

When my Markdown files are rendered to HTML, I’d like to turn each # Section into a separate <section> tag, and insert some other elements around there.

I understand I could write shortcodes to help with this, like {{% start_section "Title" %}} and {{% end_section %}} though I would prefer to continue writing standard Markdown.

Hugo offers hooks for customizing some Markdown behaviors, like how image are converted to HTML. And I can write custom processors for CSS files and so on. Is there something I could do to post-process generated HTML?

For this specific case there is an open issue that looks relevant:

Aside from the issue you linked, most folks’ solutions come down to:

  1. Using
  2. Use HTML in the markdown (adding <section> where you need, may need to configure)
  3. Use bundles and load content via params (see

Something to play with while waiting on that issue. :slight_smile:

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.