Footnotes

Michel Fortin michel.fortin at michelf.com
Fri Jul 29 11:47:01 EDT 2005


Denis Defreyne said:


> But HTML does not define footnotes and as such, IMO, do not fit

> in the scope of Markdown.


I partially agree. Markdown's scope is to help writing for the web.
This of course means HTML. But many things you write in plain text
hardly have their HTML markup equivalents, making it hard to write them
on the web. Footnotes is one of these things.

But Markdown, until now at least, always have been neutral: it simply
convert your text to a standard everyone agree upon: XHTML 1.0 or HTML
4. Introducing footnotes will change that and I can understand why it
makes some people uncomfortable. Since there is no standard, we have
three choices:

1. Use some hard-coded format. [^microformat]
2. Allow the user to customize the output.
3. Implement it as an add-on people have the choice to install or not
(or as a special version of Markdown).

Number 3 is going to be hard to implement, since you need either an
extension mechanism or to maintain two code bases. It's true that I'm
doing exactly this (maintaining two code bases with PHP Markdown Extra)
but I was doing so anyway for my own purposes. That's a lot of work.

[^microformat]:
It may be interesting to "standardise" hard-coded footnote output
as a microformat. See <http://microformats.org/>.


A. Pagaltzis said:


> Maybe what Markdown is missing is not a syntax for footnotes, but

> one for internal anchors.


I agree this is missing, and John said previously that it was planned.
In previous discussions we where looking for things like this:

Introduction {#intro}
------------

Go to the [Introduction](#intro).

Maybe footnote syntax could go that direction too, asking the user for
a relevant id. Something like that:

This text has a footnote[^test-note].

[^test-note]:
First note to test the footnote system.

This second paragraph also has a footnote[^test-note-2].

[^test-note-2]:
This is a second footnote.

Here, "test-note" and "test-note-2" are the base of the id attribute of
the footnotes.[^base-id] Footnotes are numbered automatically. If you
update the text and insert a footnote between the two, footnote numbers
will change, but not the anchors. This ensure any URL made with old
footnotes are valid while keeping URLs prettier.

It can also solve the problem of multiple entries on one page if you
make the footnotes identifiers different from those of other entries.
Note that the same problem could also arise with the "Introduction"
example above so you would have to be careful with that too.

[^base-id]:
I would form id attributes this way:

Id of the footnote link in the text
: `fnref:` followed by the base id.

Id of the footnote at the bottom
: `fn:` followed by the base id.


Michel Fortin
michel.fortin at michelf.com
http://www.michelf.com/



More information about the Markdown-Discuss mailing list