Expand description

Implement the Github Flavoured Markdown autolink extension.

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

assert_eq!(
    md.parse("www.example.com").render(),
    "<p><a href=\"http://www.example.com\">www.example.com</a></p>\n",
);

Structs

  • Scanner for URL protocols that are supported by the GFM autolink extension; http, https, mailto, and xmpp. The rule searches for :, back-scans to match the protocol name, then forward-spans to match the rest of the URL. Note, this is a balance between performance (only activating on : for all protocols) and correctness (risking that the preceding protocol has already been parsed by another rule).
  • Scanner for bare www. URLs.

Functions

  • Add the GFM autolink extension plugin to MarkdownIt.