Add markdown-it-footnotes (#5303)
This commit is contained in:
parent
0bfbd74e59
commit
2a89179611
3 changed files with 24 additions and 1 deletions
12
Cargo.lock
generated
12
Cargo.lock
generated
|
@ -2837,6 +2837,7 @@ dependencies = [
|
||||||
"lettre",
|
"lettre",
|
||||||
"markdown-it",
|
"markdown-it",
|
||||||
"markdown-it-block-spoiler",
|
"markdown-it-block-spoiler",
|
||||||
|
"markdown-it-footnote",
|
||||||
"markdown-it-ruby",
|
"markdown-it-ruby",
|
||||||
"markdown-it-sub",
|
"markdown-it-sub",
|
||||||
"markdown-it-sup",
|
"markdown-it-sup",
|
||||||
|
@ -2901,7 +2902,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34"
|
checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"windows-targets 0.48.5",
|
"windows-targets 0.52.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -3021,6 +3022,15 @@ dependencies = [
|
||||||
"markdown-it",
|
"markdown-it",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "markdown-it-footnote"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e6679ab967fbc45b290b25fb477af7556bf6825feec208a970585e6bb9aae3be"
|
||||||
|
dependencies = [
|
||||||
|
"markdown-it",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "markdown-it-ruby"
|
name = "markdown-it-ruby"
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
|
|
|
@ -89,6 +89,7 @@ markdown-it-block-spoiler = "1.0.0"
|
||||||
markdown-it-sub = "1.0.0"
|
markdown-it-sub = "1.0.0"
|
||||||
markdown-it-sup = "1.0.0"
|
markdown-it-sup = "1.0.0"
|
||||||
markdown-it-ruby = "1.0.0"
|
markdown-it-ruby = "1.0.0"
|
||||||
|
markdown-it-footnote = "0.2.0"
|
||||||
moka = { workspace = true, optional = true }
|
moka = { workspace = true, optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
|
|
@ -14,6 +14,7 @@ static MARKDOWN_PARSER: LazyLock<MarkdownIt> = LazyLock::new(|| {
|
||||||
markdown_it_sub::add(&mut parser);
|
markdown_it_sub::add(&mut parser);
|
||||||
markdown_it_sup::add(&mut parser);
|
markdown_it_sup::add(&mut parser);
|
||||||
markdown_it_ruby::add(&mut parser);
|
markdown_it_ruby::add(&mut parser);
|
||||||
|
markdown_it_footnote::add(&mut parser);
|
||||||
link_rule::add(&mut parser);
|
link_rule::add(&mut parser);
|
||||||
|
|
||||||
parser
|
parser
|
||||||
|
@ -122,6 +123,17 @@ mod tests {
|
||||||
"ruby text",
|
"ruby text",
|
||||||
"{漢|Kan}{字|ji}",
|
"{漢|Kan}{字|ji}",
|
||||||
"<p><ruby>漢<rp>(</rp><rt>Kan</rt><rp>)</rp></ruby><ruby>字<rp>(</rp><rt>ji</rt><rp>)</rp></ruby></p>\n"
|
"<p><ruby>漢<rp>(</rp><rt>Kan</rt><rp>)</rp></ruby><ruby>字<rp>(</rp><rt>ji</rt><rp>)</rp></ruby></p>\n"
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"footnotes",
|
||||||
|
"Bold claim.[^1]\n\n[^1]: example.com",
|
||||||
|
"<p>Bold claim.<sup class=\"footnote-ref\"><a href=\"#fn1\" id=\"fnref1\">[1]</a></sup></p>\n\
|
||||||
|
<hr class=\"footnotes-sep\" />\n\
|
||||||
|
<section class=\"footnotes\">\n\
|
||||||
|
<ol class=\"footnotes-list\">\n\
|
||||||
|
<li id=\"fn1\" class=\"footnote-item\">\n\
|
||||||
|
<p>example.com <a href=\"#fnref1\" class=\"footnote-backref\">↩︎</a></p>\n\
|
||||||
|
</li>\n</ol>\n</section>\n"
|
||||||
)
|
)
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue