Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Heading subscripts are stripped out in TOC extension #935

Closed
cjbraun opened this issue Apr 7, 2020 · 3 comments
Closed

Heading subscripts are stripped out in TOC extension #935

cjbraun opened this issue Apr 7, 2020 · 3 comments
Labels
duplicate The issue has been previously reported.

Comments

@cjbraun
Copy link

cjbraun commented Apr 7, 2020

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?

@waylan waylan added the needs-decision A decision needs to be made regarding request. label Apr 8, 2020
@waylan
Copy link
Member

waylan commented Jun 30, 2020

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.

@waylan waylan added extension Related to one or more of the included extensions. feature Feature request. labels Nov 3, 2021
@mondeja
Copy link
Contributor

mondeja commented Dec 18, 2021

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.

@waylan
Copy link
Member

waylan commented Apr 18, 2023

This is a duplicate of #660. Not sure how I missed that before.

@waylan waylan closed this as not planned Won't fix, can't repro, duplicate, stale Apr 18, 2023
@waylan waylan added duplicate The issue has been previously reported. and removed feature Feature request. extension Related to one or more of the included extensions. needs-decision A decision needs to be made regarding request. labels Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate The issue has been previously reported.
Projects
None yet
Development

No branches or pull requests

3 participants