Skip to main content

markdown_it/plugins/extra/
mod.rs

1//! Frequently used markdown extensions and stuff from GFM.
2//!
3//!  - strikethrough (~~xxx~~~)
4//!  - tables
5//!  - linkify (convert <http://example.com> to a link)
6//!  - beautify links (cut "http://" from links and shorten paths)
7//!  - smartquotes and typographer
8//!  - code block highlighting using `syntect`
9//!
10//! ```rust
11//! let md = &mut markdown_it::MarkdownIt::new();
12//! markdown_it::plugins::cmark::add(md);
13//! markdown_it::plugins::extra::add(md);
14//!
15//! let html = md.parse("hello ~~world~~").render();
16//! assert_eq!(html.trim(), r#"<p>hello <s>world</s></p>"#);
17//!
18//! let html = md.parse(r#"Markdown done "The Right Way(TM)""#).render();
19//! assert_eq!(html.trim(), r#"<p>Markdown done “The Right Way™”</p>"#);
20//! ```
21pub mod beautify_links;
22pub mod front_matter;
23pub mod heading_anchors;
24#[cfg(feature = "linkify")]
25pub mod linkify;
26pub mod math;
27pub mod smartquotes;
28pub mod strikethrough;
29#[cfg(feature = "syntect")]
30pub mod syntect;
31pub mod tables;
32pub mod typographer;
33
34use crate::MarkdownIt;
35
36pub fn add(md: &mut MarkdownIt) {
37    strikethrough::add(md);
38    beautify_links::add(md);
39    #[cfg(feature = "linkify")]
40    linkify::add(md);
41    tables::add(md);
42    #[cfg(feature = "syntect")]
43    syntect::add(md);
44    typographer::add(md);
45    smartquotes::add(md);
46    #[cfg(feature = "katex")]
47    math::add(md);
48}