Don't emit stashed HTML tag placeholders in .toc_tokens#901
Don't emit stashed HTML tag placeholders in .toc_tokens#901waylan merged 2 commits intoPython-Markdown:masterfrom
.toc_tokens#901Conversation
…ython-Markdown#899 Note: this slightly changes existing behavior in that raw HTML tags are no longer included in the HTML `.toc`.
|
Hmm, one problem with the "ideal" solution mentioned above is that we'd probably want to strip |
|
One other option here would be that we strip HTML tags from the heading, but if a user really wants HTML tags in their heading, they could explicitly use |
|
For For While the fix here is more restrictive than previously, it fixes the obviously wrong output and actually does what we intended to do previously. If we want to add support for formatting TOC entries, then that would be a separate new feature. |
This should resolve #899. The fix is a bit subtle, since we want to emit HTML entities for
.toc_tokens, but not HTML tags. We also want to be careful to clean updata-toc-labelas needed. Note: this change means that raw HTML in a heading is no longer passed through to the HTML for.toc.I'm not entirely happy with this. In practice, I think the ideal would be for the toc extension to include the (HTML-ized) Markdown from a heading in its TOC entry, and to have
.toc_tokensinclude bothhtmlandplaintextfields. This patch gives us a sort of middle ground, where we just use the HTML with tags stripped. The "ideal" is a larger behavioral change though, and I'm not sure it makes sense to do that for a minor release...If you think it makes sense to implement the "ideal" solution now, I can try and do that. However, this patch is sufficient for what MkDocs needs.