markdown-it-footnote.rs
A markdown-it.rs plugin to process footnotes.
It is based on the pandoc definition:
Normal footnote:
Here is a footnote reference,[^1] and another.[^longnote]
Here is an inline note.^[my note is here!]
belong to the previous footnote.
See the tests for more examples.
Usage
To load the full plugin:
let parser = &mut new;
add;
add;
let ast = parser.parse;
let html = ast.render;
Alternatively, you can load the separate components:
let parser = &mut new;
add;
add;
add;
add;
add;
add;
Which have the following roles:
definitions
: parse footnote definitions, e.g.[^1]: foo
references
: parse footnote references, e.g.[^1]
inline
: parse inline footnotes, e.g.^[foo]
collect
: collect footnote definitions (removing duplicate/unreferenced ones) and move them to be the last child of the root node.back_refs
: add anchor(s) to footnote definitions, with links back to the reference(s)