Footnotes numbering (original) (raw)

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.

"""

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?