Skip to main content

@mdit/plugin-footnote


Plugin to support footnotes.

Usage

TS
import MarkdownIt from "markdown-it";
import { footnote } from "@mdit/plugin-footnote";

const mdIt = MarkdownIt().use(footnote);

mdIt.render("Inline footnote^[Text of inline footnote] definition.");

Syntax

  • Use [^Anchor text] in Markdown to define a footnote

  • Use block starting with [^Anchor text]: ... to describe footnote content

  • If there are multiple paragraph in footnote, the paragraph show be double indented.

Nesting and escaping

  • Nestings are supported:

    Footnote 1 link[^first].
    
    [^first]: Footnote can reference [^second].
    [^second]: Other footnote.
    
  • Escaping can be done by adding \:

    The following \[^first] is not a footnote.
    

    will be

    The following [^first] is not a footnote.

Demo

Demo

Footnote 1 link[1].

Footnote 2 link[2].

Inline footnote[3] definition.

Duplicated footnote reference.

Footnote 1 link[^first].

Footnote 2 link[^second].

Inline footnote^[Text of inline footnote] definition.

Duplicated footnote reference.

[^first]: Footnote **can have markup**

    and multiple paragraphs[^second].

[^second]: Footnote text.

  1. Footnote can have markup

    and multiple paragraphs[2:1]. ↩︎

  2. Footnote text. ↩︎ ↩︎

  3. Text of inline footnote ↩︎