How should footnotes behave?


#1

A little premise: I’m not a coder, I discovered Markdown few months ago and I’m in love with it. I use it in blogs, mails, personal files, everywhere.
As many others, I’m interested in footnotes, and I’d like to understand if something similar from what I’m saying is possible.

When I write a long piece, numbering footnotes can be a pain in the ass. I can switch paragraph, and all the numbering disappears. II’d love footnotes numbering to work like ordered lists, where you just put a number and a dot, and the output is a ordered list.

  1. one
  2. two
  3. three

I’ve seen MarkDownExtra but it works like this:

some deep thought who needs a reference[^1]

[^1]: Here's the reference. 

So doesn’t solve the problem. You need to order the footnotes by yourself. It’s not automatic, as in ordered lists.

I would parse the number and have the ouput ordering both the footnotes numbers and the anchors numbers at the end.


Footnote extensions vs Link Reference Definition
Popular and needed extension
Please let me know how to insert footnotes in CommonMark
The inevitable "MarkdownExtra" topic
#2

I’m not sure about Markdown Extra, but in Kramdown you can use any string (numeric or otherwise) as the “key” for the footnote. So long as the string matches the string of what it’s referencing, the numbers will be automatically added in the correct order.

There might be a problem with this approach if we want to support multiple reference lists inside of a Markdown document though. For example, a single Markdown document could contain multiple chapters, each with its own references list. So perhaps CommonMark footnotes should be relative to a particular header?


#3

Somebody should create a new topic called Footnotes to discuss this.


#4

I’ve run into a few implementation issues with Markdown Extra’s footnotes. The same thing happens with Parsedown Extra. I haven’t tried Kramdown.

The first is that I need to support both footnotes and references, with each numbered differently. In my text, footnotes are rendered in lowercase numerals and references are numbered with standard Arabic numerals. When rendering the output, Markdown Extra conflates these two into one list with Arabic numerals.

My second problem is that sometimes I want to be able to insert a reference to a note without having the note itself in the same document. For example, I may have four Markdown files representing Chapters 1–3 + appendices of a book. I may have references to notes in each chapter, with the notes appearing in the appendices. In MarkdownExtra, if a corresponding note isn’t in the same document, the reference is ignored and not linked. It would be nice if [^1] rendered the reference link, whether or not the reference [^1]: was available. (The link wouldn’t work unless these documents were eventually combined, but that does happen at a later stage, after the Markdown is converted to HTML.)


#5

But the example in the MarkdownExtra doc (i.e., [^1]) is not prescribing a manually maintained numeric sequence ([^1]...[^2]...[^3]...[^4]...etc.). You could use:

[^uno]
[^eins]
[^one]
[^anythingyoulike]

Perhaps I’ve misunderstood the issue, but the crucial thing is: open-square-bracket + caret + unique-string + close-square-bracket as the footnote anchor. MDextra takes care of numbering the sequence.

There is (in my test of PHP MDextra) a further issue, though: the footnote anchors are correctly (and automatically) numbered, but the footnotes themselves are unnumbered, although correctly ordrered. I never noticed that before.


#6

I’m sorry, I’m new here…
I’m interested in footnotes, and I can’t find a markdown working ( [^1][^1] doesn’t seem to work in my discourse).
There are some advances?
Thank you!


#7

Discourse does not currently support footnotes. The discussion here is about adding footnotes to the CommonMark spec as an extension, but not all applications that use CommonMark will necessarily enable the extension. So even if Discourse adopts CommonMark in the future, it still may not allow footnotes.