diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-08-18 18:33:10 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-08-18 18:33:17 +0200 |
commit | 25e267afbc0789ea36508d45c3ea3545b84223bb (patch) | |
tree | 8dee2a78ad1df29e9df7cf151091a5d265fd7ecb /src/lib.rs | |
parent | 1dbf02d8c1955316c6cc43a427f506b91c87ef3a (diff) | |
download | markdown-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.rs | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -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 { |