Generate a table of contents from a Markdown document. By default the heading anchor calculation (aka the "slugification") is done in a way that attempts to mimic GitHub's (undocumented) behavior.
Add the pulldown-cmark-toc
to your Cargo.toml
.
cargo add pulldown-cmark-toc
```rust use pulldowncmarktoc::TableOfContents;
let text = r#"
code
"#;
let toc = TableOfContents::new(text);
asserteq!(
toc.tocmark(),
r#"- Heading
- Subheading
- Subheading with code
"#
);
}
```
Licensed under either of
at your option.