Footnotes

John Gruber gruber at fedora.net
Thu Jul 28 12:02:41 EDT 2005


Michel Fortin <michel.fortin at michelf.com> wrote on 07/27/05 at 12:59 pm:


> I was asking myself last weekend what exactly could be a great syntax

> for footnotes (which could be part of PHP Markdown Extra). I think John

> just used it:

>

> John Gruber wrote:

>

> > If you want to specify alignment, you'll have to assign a class to

> > the paragraph. [^1] Or to a parent div:

> >

> > [...]

> >

> > [^1]: Search the list archives for some of my syntax ideas for how

> > you might be able to assign classes to paragraphs and other

> > block elements.


That wasn't a coincidence. I've been thinking about this a lot.



> And for multiple-paragraph footnotes[^2], just indent the second

> paragraph, or the blockquote, or the list...

>

> [^2]: First paragraph for this footnote

> using two lines.

>

> Second paragraph for the footnote.

>

> > blockquote

>

> * list

>

> Footnotes could appear anywhere, but would be put automatically at the

> end of the document.


Exactly.



> It still need a little more thought, especially about id attributes

> which should not clash with anything else on the same page. Often,

> there is more than one weblog entry on a page.


Right; that's why we can't use IDs like "fn1", "fn2" -- you could
have two posts on the same page, both with footnotes, and they'll
need unique IDs.

We could veer the other way and generate IDs using some sort of hash
(MD5 or whatever), or some other GUID algorithm. But such IDs ought
to be stable -- meaning that if you run the same input twice, you
should get the same unique IDs both times. The other thing is that
you ought to get the same IDs for yur footnotes if you edit an
existing post.

I'm thinking maybe there'd be a default ID algorithm, but that it
could be overridden with a callback or something. That way a weblog
system could generate IDs that are tied to the post IDs, which ought
to make them somewhat unique.

Perhaps the *default* ID algorithm would be to just produce simple
IDs like "fn1", "fn2", ... -- and then if you're using Markdown in a
system where multiple article may appear on the same page, it would
be your responsibility to provide a new ID generation algorithm that
will produce unique values.

-J.G.


More information about the Markdown-Discuss mailing list