Footnotes
John Gruber
gruber at fedora.net
Mon Aug 1 01:46:38 EDT 2005
Michel Fortin <michel.fortin at michelf.com> wrote on 07/29/05 at 11:47 am:
> 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.
I hadn't thought of that. I was planning on making is so that the
note identifiers -- [^like-this] -- could be whatever you wanted,
and that numbering would be handled by Markdown. So you could write
like this:
This [^1] is a sentence [^2] with three [^3] footnote references.
[^1]: This is the first note.
[^2]: This is the second note.
[^3]: This is the third note.
But you could also write like this, and produce the exact same output:
This [^foo] is a sentence [^bar] with three [^baz] footnote references.
[^foo]: This is the first note.
[^bar]: This is the second note.
[^baz]: This is the third note.
The idea being that you, the author, could "name" your footnotes
however you wanted. If you want to use numbers, go right ahead. But
it might be easier to name them some other way, so that you can move
them around and insert more notes during editing, and not have to
worry about renumbering all your other note references manually.
What you (Michel) have suggested here is that we *do* make the
identifiers for the notes important, by using them as part of the
`id` HTML attributes in the output. Interesting.
> It can also solve the problem of multiple entries on one page if you
> make the footnotes identifiers different from those of other entries.
That's the reason it's interesting. It allows us to force the author
to help us keep the IDs unique if there are going to be several
posts with footnotes on the same page.
> [^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.
I still wonder if we want to put the number of the note in those IDs:
fn1:blah
for the first footnote, instead of
fn:blah
But the advantage to *not* including the numbers is, as you point
out, that the IDs won't change if you make an edit that inserts,
moves, or removes a footnote from the text.
-J.G.
More information about the Markdown-Discuss
mailing list