/

Embedding HTML in Markdown with Hugo

Embedding HTML in Markdown with Hugo

Recently, I made the switch from the deprecated markdown renderer, Blackfriday, to the default Hugo markdown renderer, Goldmark. While this transition had been long overdue, it came with a drawback - all the embedded HTML in my markdown files ceased to work.

However, I found a solution to this issue by enabling a specific option in my Hugo configuration file, whether it be config.yaml or config.toml. Here’s how to do it:

For config.yaml:

1
2
3
4
markup:
goldmark:
renderer:
unsafe: true

For config.toml:

1
2
[markup.goldmark.renderer]
unsafe = true

By setting the unsafe option to true, I was able to regain the functionality of embedded HTML within my markdown files.

With this configuration, I can now seamlessly embed HTML code in my markdown content, enhancing the flexibility and richness of my Hugo-powered website.

Tags: Hugo, Goldmark, Markdown, HTML embedding