aboutsummaryrefslogtreecommitdiffstats
path: root/src/construct/text.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-09-09 13:17:59 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-09-09 13:17:59 +0200
commit118cc91fd56a9b4c93bec5b1cb4c5f25924d353e (patch)
tree3a33911c5b3f7da33919dfb48f1a0b8f8b46bb1b /src/construct/text.rs
parentffef323d3c927f84e94cae21afeb541be7320f1c (diff)
downloadmarkdown-rs-118cc91fd56a9b4c93bec5b1cb4c5f25924d353e.tar.gz
markdown-rs-118cc91fd56a9b4c93bec5b1cb4c5f25924d353e.tar.bz2
markdown-rs-118cc91fd56a9b4c93bec5b1cb4c5f25924d353e.zip
Add mdx expression (flow, text)
Diffstat (limited to 'src/construct/text.rs')
-rw-r--r--src/construct/text.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/construct/text.rs b/src/construct/text.rs
index b59fe65..34ea071 100644
--- a/src/construct/text.rs
+++ b/src/construct/text.rs
@@ -18,6 +18,7 @@
//! * [Label start (image)][crate::construct::label_start_image]
//! * [Label start (link)][crate::construct::label_start_link]
//! * [Label end][crate::construct::label_end]
+//! * [MDX: expression (text)][crate::construct::mdx_expression_text]
//! * [MDX: JSX (text)][crate::construct::mdx_jsx_text]
//!
//! > 👉 **Note**: for performance reasons, hard break (trailing) is formed by
@@ -30,7 +31,7 @@ use crate::state::{Name as StateName, State};
use crate::tokenizer::Tokenizer;
/// Characters that can start something in text.
-const MARKERS: [u8; 15] = [
+const MARKERS: [u8; 16] = [
b'!', // `label_start_image`
b'$', // `raw_text` (math (text))
b'&', // `character_reference`
@@ -45,6 +46,7 @@ const MARKERS: [u8; 15] = [
b'`', // `raw_text` (code (text))
b'h', // `gfm_autolink_literal` (`protocol` kind)
b'w', // `gfm_autolink_literal` (`www.` kind)
+ b'{', // `mdx_expression_text`
b'~', // `attention` (gfm strikethrough)
];
@@ -153,6 +155,13 @@ pub fn before(tokenizer: &mut Tokenizer) -> State {
);
State::Retry(StateName::LabelEndStart)
}
+ Some(b'{') => {
+ tokenizer.attempt(
+ State::Next(StateName::TextBefore),
+ State::Next(StateName::TextBeforeData),
+ );
+ State::Retry(StateName::MdxExpressionTextStart)
+ }
_ => State::Retry(StateName::TextBeforeData),
}
}