Module markdown_it::plugins::sourcepos
source · Expand description
Add source mapping to resulting HTML, looks like this: <stuff data-sourcepos="1:1-2:3">
.
let md = &mut markdown_it::MarkdownIt::new();
markdown_it::plugins::cmark::add(md);
markdown_it::plugins::sourcepos::add(md);
let html = md.parse("# hello").render();
assert_eq!(html.trim(), r#"<h1 data-sourcepos="1:1-1:7">hello</h1>"#);