Repository navigation
Fix toc crash on a heading with a valueless data-toc-label - #1714
Merged
waylan merged 1 commit intoNov 17, 2026
Merged
Conversation
The `attr_list` extension writes a bare attribute with a value of
None, so `{: data-toc-label }` reached `unescape(None)` and raised
`TypeError`. A valueless label is now treated like a missing one: the
heading text is used as the TOC name and the attribute is removed, as
Python-Markdown#1706 did for a valueless `id`.
The check is `is not None` rather than a falsy test so that an explicit
`data-toc-label=""` still gives an empty name, as before.
Fixes Python-Markdown#1712.
12 of 15 tasks
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
Fixes #1712.
data-toc-labelwithout a value is now treated as absent (same asidin #1706): the TOC name is taken from the heading text and the attribute is removed. An explicit emptydata-toc-label=""still produces an empty name, so the check is specifically forNone.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:
Tool: Claude Code (Anthropic; Claude Sonnet wrote the fix, tests, code comments, changelog entry and commit message; Claude Opus reviewed them).
I reviewed every change. I wrote the description above myself, from notes Claude Code prepared.
Checklist