aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-09-06 18:30:40 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-09-06 18:30:40 +0200
commit6af582ee16d9c54c9719144caabc7705a324c40b (patch)
treed80cd71964a38fb4cd1b4c1df8acfc256d4cbcba /src/lib.rs
parent537bf2d6b7b3a2f7855f7628159aecaea2acdb0f (diff)
downloadmarkdown-rs-6af582ee16d9c54c9719144caabc7705a324c40b.tar.gz
markdown-rs-6af582ee16d9c54c9719144caabc7705a324c40b.tar.bz2
markdown-rs-6af582ee16d9c54c9719144caabc7705a324c40b.zip
Add initial states for MDX JSX (text)
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs29
1 files changed, 29 insertions, 0 deletions
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 <Component /> 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.
///
+ /// <https://github.github.com/gfm/>
+ ///
/// This turns on `CommonMark` + GFM.
#[must_use]
pub fn gfm() -> Self {
@@ -363,6 +373,25 @@ impl Constructs {
..Self::default()
}
}
+
+ /// MDX.
+ ///
+ /// <https://mdxjs.com>
+ ///
+ /// 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).