Due to Markdown’s inability to center and resize image properly, I use the raw HTML tags inside markdown file to include images:

<p align="center">
<img src="xxx.xx.xx/test.jpg">
</p>


Recently, after updating to Hugo version 0.62, I found that all the images using HTML tags are missing in the generated HTML files.

I checked the generated HTML source file for my post, and found that the raw HTML tag for image is rendered as the following comment tag:

<!-- raw HTML omitted -->


After a little dig, I find out the cause. Previously, Hugo was using Blackfriday to render Markdown files. Since Hugo version 0.60, the default Markdown renderer has been changed to goldmark. In goldmark, the default behaviour is not to render raw HTML tags.

To fix this issue, we have two options. First option, set blackfriday as the default Markdown engine. Open config.toml and add the following setting:

[markup]
defaultMarkdownHandler = "blackfriday"


Second option, use goldmark and set the unsafe option of markup.goldmark.renderer to true:

[markup]
defaultMarkdownHandler = "goldmark"
[markup.goldmark]
[markup.goldmark.renderer]
unsafe = true