smhk

Hugo 0.37 does not support h6 markdown heading

Posts for this website are written in markdown, and the HTML you read is generated by hugo. Recently, when trying to use ###### blah for a markdown heading, which should generate a <h6> HTML tag, I found that hugo started generating a table of contents for the post. Remove the heading, or reduce it to ##### blah, and the table of contents goes away.

Normally a table of contents would only be shown for a post if the {{ .TableOfContents }} tag is used. However if an h6 markdown heading is used, then a table of contents is generated and there is no way to stop that happening.

This issue seemed so bizarre that at first I was convinced it must have been a mistake on my behalf. After some searching I found a comment on a tangentially related issue from September 2016 which reports the same symptom, and then again in December 2017 an issue raised specifically about this bug.

So what is the solution? As far as I can tell, the best is just to not use the h6 tag.