From 6af582ee16d9c54c9719144caabc7705a324c40b Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Tue, 6 Sep 2022 18:30:40 +0200 Subject: Add initial states for MDX JSX (text) --- src/lib.rs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index e3fdfcb..7fd705b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -301,6 +301,13 @@ pub struct Constructs { /// ^^^ /// ``` pub math_text: bool, + /// MDX: JSX (text). + /// + /// ```markdown + /// > | a c + /// ^^^^^^^^^^^^^ + /// ``` + pub mdx_jsx_text: bool, /// Thematic break. /// /// ```markdown @@ -342,6 +349,7 @@ impl Default for Constructs { list_item: true, math_flow: false, math_text: false, + mdx_jsx_text: false, thematic_break: true, } } @@ -350,6 +358,8 @@ impl Default for Constructs { impl Constructs { /// GFM. /// + /// + /// /// This turns on `CommonMark` + GFM. #[must_use] pub fn gfm() -> Self { @@ -363,6 +373,25 @@ impl Constructs { ..Self::default() } } + + /// MDX. + /// + /// + /// + /// This turns on `CommonMark`, turns off some conflicting constructs + /// (autolinks, code (indented), html), and turns on MDX (JSX, + /// expressions, ESM). + #[must_use] + pub fn mdx() -> Self { + Self { + autolink: false, + code_indented: false, + html_flow: false, + html_text: false, + mdx_jsx_text: true, + ..Self::default() + } + } } /// Configuration (optional). -- cgit