markdown-it-footnote.rs

crates.io

A markdown-it.rs plugin to process footnotes.

It is based on the pandoc definition:

```md Normal footnote:

Here is a footnote reference,[^1] and another.[^longnote]

Here is an inline note.^[my note is here!]

Subsequent paragraphs are indented to show that they

belong to the previous footnote. ```

See the tests for more examples.

Usage

To load the full plugin:

```rust let parser = &mut markdownit::MarkdownIt::new(); markdownit::plugins::cmark::add(parser);

markdownitfootnote::add(parser);

let ast = parser.parse("Example^[my note]"); let html = ast.render(); ```

Alternatively, you can load the separate components:

```rust let parser = &mut markdownit::MarkdownIt::new(); markdownit::plugins::cmark::add(parser);

markdownitfootnote::definitions::add(md); markdownitfootnote::references::add(md); markdownitfootnote::inline::add(md); markdownitfootnote::collect::add(md); markdownitfootnote::back_refs::add(md); ```

Which have the following roles: