markdown_that/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_that::MarkdownThat::new();
12//! markdown_that::plugins::cmark::add(md);
13//! markdown_that::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 heading_anchors;
23#[cfg(feature = "linkify")]
24pub mod linkify;
25pub mod smartquotes;
26pub mod strikethrough;
27#[cfg(feature = "syntect")]
28pub mod syntect;
29pub mod tables;
30pub mod typographer;
31
32use crate::MarkdownThat;
33
34pub fn add(md: &mut MarkdownThat) {
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}