Skip to content

Nested block footnotes rendered in wrong order #1561

@tmarplatt

Description

@tmarplatt

(Python Markdown 3.9; mkdocs 1.6.1 with footnotes extension; Python 3.12)

While using mkdocs I stumbled upon this problem:

Footnote anchors and footnotes themselves are rendered out of order when, in the source and in addition to other document-level footnotes, one ore more footnotes are being referenced from within a nested block, such as a list element or a quote block.

If Python Markdown is downgraded to version 3.8.2, footnotes will be rendered correctly.

Here's a reproducible Markdown case:

# Heading The following footnote anchor is the first one.[^1] ## Subheading The following footnote anchor 1. should be the second one, but mkdocs renders it in fourth place.[^2] 1. Note that every anchor still points to its correct, matching footnote. The following footnote anchor is the third one, but will be rendered in second place. [^3] > Now in a quote block, possibly reproducible in any other nested block. Fourth yet shown as fifth footnote anchor.[^4] Last, fifth footnote anchor.[^5] ### Footnotes rendered out of order: [^1]: First [^2]: Second [^3]: Third [^4]: Fourth [^5]: Fifth 

For reference, here is what I see via mkdocs serve:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions