Module markdown_it::plugins::extra

source ·
Expand description

Frequently used markdown extensions and stuff from GFM.

It currently includes ~~strikethrough~~ syntax, other things like tables may be included here in the future.

let md = &mut markdown_it::MarkdownIt::new();
markdown_it::plugins::cmark::add(md);
markdown_it::plugins::extra::add(md);

let html = md.parse("hello ~~world~~").render();
assert_eq!(html.trim(), r#"<p>hello <s>world</s></p>"#);

let html = md.parse(r#"Markdown done "The Right Way(TM)""#).render();
assert_eq!(html.trim(), r#"<p>Markdown done “The Right Way™”</p>"#);

Modules

  • Pretty-print all urls and fit them into N characters
  • Add id attribute (slug) to headings.
  • Find urls and emails, and turn them into links
  • Replaces " and ' quotes with “nicer” ones like , , , , or with for words like “isn’t”.
  • Strikethrough syntax (like ~~this~~)
  • Syntax highlighting for code blocks
  • GFM tables
  • Common textual replacements for dashes, ©, ™, …

Functions