1
0
Fork 0
mirror of https://github.com/Nutomic/ibis.git synced 2024-11-22 07:01:09 +00:00

Add anchors to markdown headings (fixes #77)

This commit is contained in:
Felix Ableitner 2024-10-23 11:24:30 +02:00
parent 61fb9081ec
commit e7d480098f
3 changed files with 23 additions and 0 deletions

21
Cargo.lock generated
View file

@ -1425,6 +1425,16 @@ version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0"
[[package]]
name = "github-slugger"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "721820f4eab1c427d482e144b63288754d9872fb7f0d72d73ab101008ef43147"
dependencies = [
"once_cell",
"regex",
]
[[package]] [[package]]
name = "gloo-net" name = "gloo-net"
version = "0.6.0" version = "0.6.0"
@ -1736,6 +1746,7 @@ dependencies = [
"log", "log",
"markdown-it", "markdown-it",
"markdown-it-block-spoiler", "markdown-it-block-spoiler",
"markdown-it-heading-anchors",
"once_cell", "once_cell",
"pretty_assertions", "pretty_assertions",
"rand", "rand",
@ -2304,6 +2315,16 @@ dependencies = [
"markdown-it", "markdown-it",
] ]
[[package]]
name = "markdown-it-heading-anchors"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c8c71a46fc41bf2fdac133c188c1477562b7bcd1be3981e84fc81cfc2e515fe"
dependencies = [
"github-slugger",
"markdown-it",
]
[[package]] [[package]]
name = "matchit" name = "matchit"
version = "0.7.3" version = "0.7.3"

View file

@ -82,6 +82,7 @@ tower-layer = "0.3.3"
katex = { version = "0.4", default-features = false } katex = { version = "0.4", default-features = false }
include_dir = "0.7.4" include_dir = "0.7.4"
markdown-it-block-spoiler = "1.0.0" markdown-it-block-spoiler = "1.0.0"
markdown-it-heading-anchors = "0.3.0"
[dev-dependencies] [dev-dependencies]
pretty_assertions = "1.4.1" pretty_assertions = "1.4.1"

View file

@ -29,6 +29,7 @@ pub fn render_markdown(text: &str) -> String {
fn markdown_parser() -> MarkdownIt { fn markdown_parser() -> MarkdownIt {
let mut parser = MarkdownIt::new(); let mut parser = MarkdownIt::new();
markdown_it::plugins::cmark::add(&mut parser); markdown_it::plugins::cmark::add(&mut parser);
markdown_it_heading_anchors::add(&mut parser);
markdown_it::plugins::extra::strikethrough::add(&mut parser); markdown_it::plugins::extra::strikethrough::add(&mut parser);
markdown_it::plugins::extra::tables::add(&mut parser); markdown_it::plugins::extra::tables::add(&mut parser);
markdown_it::plugins::extra::typographer::add(&mut parser); markdown_it::plugins::extra::typographer::add(&mut parser);