russross/blackfriday — pull request #27 by moshee (2013-07-01 02:07:03+00:00)
Title: Footnotes (addresses #14)

This is my attempt at adding support for footnotes and inline footnotes in the style of Pandoc:

```
This is a footnote[^1]^[and this is an inline footnote]

[^1]: the footnote text.

may be multiple paragraphs.
```

...should become...

```html

This is a footnote12

the footnote text.

may be multiple paragraphs.

and this is an inline footnote

```

If anybody wants to add benchmarks and more tests that would be great.

#### Caveats:

- Since blackfriday does not produce an AST, it is not that simple to append a link back to the footnote reference in the article. As such, I've skipped that functionality for the time being. Note that it needs to place a link in a different place depending on the last element in the block. If the last element in the footnote is a paragraph, it appends it to the end of the paragraph, but if it's a recognised block element, it'll need to create a new paragraph. I'm sure there are ways to do this, but I can't think of anything elegant.
- The way footnote reference IDs are generated may not be safe with running the parser several times in the course of the same document.
- I don't know TeX, so I just put an empty skeleton implementation in the LaTeX renderer to satisfy the interface.

Otherwise, both regular (referenced) footnotes and inline footnotes