Heading subscripts are stripped out in TOC extension
A heading with a subscript, i.e. ### CO<sub>2</sub> Emissions now gets the <sub> tag stripped out in the table of contents as of the 3.2 release (issue #899).
I understand that arbitrary HTML in the headings is undesirable, but for some formatting tags it seems like the most straightforward approach.
Until there is a different way to format TOC entries, is there a workaround for this, or do I just need to keep using an older release?
I understand that arbitrary HTML in the headings is undesirable, but for some formatting tags it seems like the most straightforward approach.
The problem is that we would need to parse the raw HTML and check the tag against a whitelist to do that. We don't actually parse raw HTML (we just remove anything between < and >. I'm not sure if we want to get any more sophisticated than that.
is there a workaround for this
You can define a custom label if you are also using the attr_list extension via the data-toc-label attribute. However, that also strips out raw HTML tags.
Have you considered to return the raw Markdown or HTML in raw_md or raw_html keys of toc_tokens output of toc extension @waylan? This would allow to Mkdocs to format the table of contents properly.
This is a duplicate of #660. Not sure how I missed that before.