diff --git a/Cargo.lock b/Cargo.lock index 6f7fedfb27..3fa8ac655d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2837,6 +2837,7 @@ dependencies = [ "lettre", "markdown-it", "markdown-it-block-spoiler", + "markdown-it-footnote", "markdown-it-ruby", "markdown-it-sub", "markdown-it-sup", @@ -2901,7 +2902,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" dependencies = [ "cfg-if", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] @@ -3021,6 +3022,15 @@ dependencies = [ "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]] name = "markdown-it-ruby" version = "1.0.0" diff --git a/crates/utils/Cargo.toml b/crates/utils/Cargo.toml index ded84132ce..64f36d54a9 100644 --- a/crates/utils/Cargo.toml +++ b/crates/utils/Cargo.toml @@ -89,6 +89,7 @@ markdown-it-block-spoiler = "1.0.0" markdown-it-sub = "1.0.0" markdown-it-sup = "1.0.0" markdown-it-ruby = "1.0.0" +markdown-it-footnote = "0.2.0" moka = { workspace = true, optional = true } [dev-dependencies] diff --git a/crates/utils/src/utils/markdown/mod.rs b/crates/utils/src/utils/markdown/mod.rs index 25ac0ffd65..58f03d9105 100644 --- a/crates/utils/src/utils/markdown/mod.rs +++ b/crates/utils/src/utils/markdown/mod.rs @@ -14,6 +14,7 @@ static MARKDOWN_PARSER: LazyLock = LazyLock::new(|| { markdown_it_sub::add(&mut parser); markdown_it_sup::add(&mut parser); markdown_it_ruby::add(&mut parser); + markdown_it_footnote::add(&mut parser); link_rule::add(&mut parser); parser @@ -122,6 +123,17 @@ mod tests { "ruby text", "{漢|Kan}{字|ji}", "

(Kan)(ji)

\n" + ), + ( + "footnotes", + "Bold claim.[^1]\n\n[^1]: example.com", + "

Bold claim.[1]

\n\ +
\n\ +
\n\ +
    \n\ +
  1. \n\ +

    example.com ↩︎

    \n\ +
  2. \n
\n
\n" ) ];