Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Footnotes numbering #1367

Open
alexvoss opened this issue Aug 2, 2023 · 2 comments
Open

Footnotes numbering #1367

alexvoss opened this issue Aug 2, 2023 · 2 comments
Labels
docs Related to the project documentation. extension Related to one or more of the included extensions. someday-maybe Approved low priority request.

Comments

@alexvoss
Copy link

alexvoss commented Aug 2, 2023

The numbering of footnotes follows the order in which the footnotes are defined rather than the order in which they are referenced in the document. This is somewhat surprising.

To reproduce:

#!/usr/bin/env python
import markdown

text = """
# Footnotes ordering

It seems that footnotes appear in the order in which they are
defined[^definedsecond] rather than in the order of their 
occurrence[^definedfirst] in the text.

[^definedfirst]: blah
[^definedsecond]: blurb
"""

print(markdown.markdown(text, extensions=['footnotes']))

(Naively) expected behaviour: the footnotes are numbered 1 then 2 but they come out as 2 then 1.

I do realize that changing the behavior could break things, so perhaps documenting this would be the way to go?

@waylan
Copy link
Member

waylan commented Aug 2, 2023

Our documentation states:

Python-Markdown’s Footnote syntax follows the generally accepted syntax of the Markdown community at large and almost exactly matches PHP Markdown Extra’s implementation of footnotes.

We have no intention of changing our behavior when it matches the generally accepted behavior across multiple implementations.

Regarding documenting the behavior, we don't actually document it. Instead we rely on PHP Markdown Extra's documentation to describe the behavior. Whether that should change is a question I have asked from time to time. In the end, we haven't made a change because no-one was willing to do the work. However, if someone was to submit a pull request which included documentation of the full behavior of our extension, I would be willing to review and guide it toward acceptance.

@waylan waylan added docs Related to the project documentation. someday-maybe Approved low priority request. extension Related to one or more of the included extensions. labels Aug 2, 2023
@alexvoss
Copy link
Author

alexvoss commented Aug 2, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Related to the project documentation. extension Related to one or more of the included extensions. someday-maybe Approved low priority request.
Projects
None yet
Development

No branches or pull requests

3 participants
@waylan @alexvoss and others