After updating Hugo to the latest version (v0.62), apart from the issue of missing HTML code, I have also observed that level 1 header written in Markdown is not rendered in the generated TOC.
After searching for a little bit, it turns out it has also something to do with
Hugo’s new goldmark
Markdown renderer.
According to Hugo’s documentation,
it now renders Markdown headings starting from level 2 and ending in level 3.
That is why level 1 headings are now not rendered.
To fix this issue, you need to add the following settings to your config.toml
:
[markup]
[markup.tableOfContents]
endLevel = 4
startLevel = 1