aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-08-18 18:33:10 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-08-18 18:33:17 +0200
commit25e267afbc0789ea36508d45c3ea3545b84223bb (patch)
tree8dee2a78ad1df29e9df7cf151091a5d265fd7ecb /src/lib.rs
parent1dbf02d8c1955316c6cc43a427f506b91c87ef3a (diff)
downloadmarkdown-rs-25e267afbc0789ea36508d45c3ea3545b84223bb.tar.gz
markdown-rs-25e267afbc0789ea36508d45c3ea3545b84223bb.tar.bz2
markdown-rs-25e267afbc0789ea36508d45c3ea3545b84223bb.zip
Add support for GFM autolink literals
Diffstat (limited to '')
-rw-r--r--src/lib.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 00f1c5c..ba257db 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -166,6 +166,13 @@ pub struct Constructs {
/// ^^^
/// ````
pub frontmatter: bool,
+ /// GFM: autolink literal.
+ ///
+ /// ```markdown
+ /// > | https://example.com
+ /// ^^^^^^^^^^^^^^^^^^^
+ /// ```
+ pub gfm_autolink_literal: bool,
/// Hard break (escape).
///
/// ```markdown
@@ -263,6 +270,7 @@ impl Default for Constructs {
code_text: true,
definition: true,
frontmatter: false,
+ gfm_autolink_literal: false,
hard_break_escape: true,
hard_break_trailing: true,
heading_atx: true,
@@ -278,6 +286,19 @@ impl Default for Constructs {
}
}
+impl Constructs {
+ /// GFM.
+ ///
+ /// This turns on `CommonMark` + GFM.
+ #[must_use]
+ pub fn gfm() -> Self {
+ Self {
+ gfm_autolink_literal: true,
+ ..Self::default()
+ }
+ }
+}
+
/// Configuration (optional).
#[derive(Clone, Debug, Default)]
pub struct Options {