| 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 | //! ``` |
| 21 | pub mod beautify_links; |
| 22 | pub mod heading_anchors; |
| 23 | #[cfg(feature = "linkify")] |
| 24 | pub mod linkify; |
| 25 | pub mod smartquotes; |
| 26 | pub mod strikethrough; |
| 27 | #[cfg(feature = "syntect")] |
| 28 | pub mod syntect; |
| 29 | pub mod tables; |
| 30 | pub mod typographer; |
| 31 | |
| 32 | use crate::MarkdownIt; |
| 33 | |
| 34 | pub fn add(md: &mut MarkdownIt) { |
| 35 | strikethrough::add(md); |
| 36 | beautify_links::add(md); |
| 37 | #[cfg(feature = "linkify")] |
| 38 | linkify::add(md); |
| 39 | tables::add(md); |
| 40 | #[cfg(feature = "syntect")] |
| 41 | syntect::add(md); |
| 42 | typographer::add(md); |
| 43 | smartquotes::add(md); |
| 44 | } |