Repository navigation
Fix TOC labels for quoted HTML angle brackets - #1671
Merged
waylan merged 1 commit intoOct 22, 2026
Merged
Conversation
The TOC tag stripper stops at the first greater-than sign, including one inside a quoted attribute. Attribute text then enters heading IDs and TOC labels. Reuse the inline parser's HTML pattern to strip the complete tag in both heading content and custom labels, preserving HTML entities. Add regression coverage for both quote styles, embedded quotes, multiline attributes, generated IDs, TOC tokens, and custom labels. Assisted by Codex with investigation, implementation, tests, changelog, validation, and this commit message. Signed-off-by: Casper Verbuyst <casperverbuyst@gmail.com>
waylan
approved these changes
Oct 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
With
tocenabled,# <abbr title="Python > 3">Python</abbr> supportproduces the TOC label
3">Python supportand heading ID3python-support.The tag stripper treats the
>inside the quoted attribute as the end ofthe tag. The same problem affects HTML in
data-toc-label.Reuse the inline parser's HTML pattern in
strip_tagsso complete tags areremoved. The heading ID and label become
python-supportandPython support. Raw heading HTML and HTML entities are preserved.Regression tests cover single and double quotes, embedded quotes, multiline
attributes, heading IDs, rendered TOC, TOC tokens, and custom labels. All
nine new regression subcases fail on unchanged master and pass with the fix.
Validation on Windows:
Zensical documentation build pass.
extraandtoc:rendered output, TOC, and tokens are unchanged.
HTML Tidy checks and documentation spellchecking were not run. Other operating systems and the full
upstream CI matrix were not run locally.
AI Assistance Disclosure
No AI tools were used in preparing this PR.
AI tools were used and I have disclosed which ones, and have fully reviewed and verified their output.
AI tools were use to assist with the following:
Assisted by Codex
Checklist