Module sourcepos

Source
Expand description

Add source mapping to resulting HTML, looks like this: <stuff data-sourcepos="1:1-2:3">.

let md = &mut markdown_that::MarkdownThat::new();
markdown_that::plugins::cmark::add(md);
markdown_that::plugins::sourcepos::add(md);

let html = md.parse("# hello").render();
assert_eq!(html.trim(), r#"<h1 data-sourcepos="1:1-1:7">hello</h1>"#);

Functionsยง

add