@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.");
JS
const MarkdownIt = require("markdown-it");
const { footnote } = require("@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 footnoteUse block starting with
[^Anchor text]: ...
to describe footnote contentIf 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[^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.