Due to Markdown’s inablity 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:
<!-- raw HTML omitted -->
After a little dig, I find out the cause. Previouly, 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 is not to render raw HTML tags.
To fix this issue, you 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] defaultMarkdownHandler = "goldmark" [markup.goldmark] [markup.goldmark.renderer] unsafe = true
License CC BY-NC-ND 4.0