Repository navigation
Conversation
Contributor
Author
|
Closing this one to keep the queue clear — it has had no maintainer reply in 7 days. The branch stays in my fork, and I'm happy to reopen it if there's interest. |
Member
|
I added the |
tony1233200
force-pushed
the
nested-footnote-definition-as-text-1681
branch
from
November 25, 2026 12:33
4d20ff3 to
7791d37
Compare
waylan
reviewed
Nov 25, 2026
Member
|
This looks good. However, it needs to be merged with master and the changelog entry will need to be moved to a new |
An indented footnote definition nested in another footnote's content was extracted when the parent footnote was rendered, too late to be included in the footnotes div: the definition text was silently dropped and references to it produced links to a missing anchor. Matching PHP Markdown Extra, definitions are no longer recognized within a footnote definition: the FootnoteBlockProcessor is disabled while footnote content is being rendered, so a nested definition remains as text in the parent footnote and references to it stay unresolved. The ReferenceProcessor no longer treats a definition with an identifier starting with '^' as a link reference, as that is footnote definition syntax; this keeps the nested definition from being swallowed as a link reference instead. Fixes Python-Markdown#1681
The core ReferenceProcessor must not know about footnotes: the '^' exclusion now lives in a FootnoteReferenceProcessor in the footnotes extension, registered under the same name and priority only while the extension is loaded. Without the extension, '[^a]: ...' is still a link reference. Fixes Python-Markdown#1681
The 3.11.4 release landed while this PR was in review; the Python-Markdown#1681 entry moves back under a new Unreleased section.
tony1233200
force-pushed
the
nested-footnote-definition-as-text-1681
branch
from
November 26, 2026 22:37
b765b4a to
a435dbb
Compare
Contributor
Author
waylan
approved these changes
Nov 26, 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
This replaces #1710 with the behavior @waylan described as acceptable on #1681: footnote definitions are not recognized within a footnote definition (matching PHP Markdown Extra), so a nested definition remains as text in the parent footnote.
Previously, an indented definition nested in another footnote's content was extracted when the parent footnote's content was rendered — too late to appear in the footnotes div. The definition text was silently dropped, and a reference to it produced a link to a
#fn:anchor that never exists.The change has two parts:
FootnoteBlockProcessoris disabled while footnote content is being rendered (FootnoteExtension.parsing_footnotes, set around theparseChunkcalls inmakeFootnotesDiv). A nested definition is left as content of the footnote being rendered, and references to it stay unresolved text — no dead anchor.ReferenceProcessorno longer matches a definition whose identifier starts with^. That is footnote definition syntax (at the top level such lines are always claimed by the footnote processor first, so this only changes the footnote-content path, where the line was previously swallowed as a link reference and vanished).With the issue's example, footnote 1 now renders as:
Two regression tests cover the nested definition on its own and referenced from the parent footnote; both fail without the fix. The full test suite passes (1223 tests). A changelog entry is included.
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:
The AI tool used was Claude. I reproduced the issue, reviewed the maintainer's guidance on acceptable behavior, verified the rendered output against it, and ran the full test suite myself.
Checklist