aboutsummaryrefslogtreecommitdiffstats
path: root/src/construct/mdx_expression_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/mdx_expression_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 '')
-rw-r--r--src/construct/mdx_expression_text.rs34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/construct/mdx_expression_text.rs b/src/construct/mdx_expression_text.rs
new file mode 100644
index 0000000..8d061eb
--- /dev/null
+++ b/src/construct/mdx_expression_text.rs
@@ -0,0 +1,34 @@
+//! To do.
+
+use crate::event::Name;
+use crate::state::{Name as StateName, State};
+use crate::tokenizer::Tokenizer;
+
+/// Start of MDX: expression (text).
+///
+/// ```markdown
+/// > | a {Math.PI} c
+/// ^
+/// ```
+pub fn start(tokenizer: &mut Tokenizer) -> State {
+ if Some(b'{') == tokenizer.current
+ && tokenizer.parse_state.options.constructs.mdx_expression_text
+ {
+ tokenizer.tokenize_state.token_1 = Name::MdxTextExpression;
+ tokenizer.attempt(State::Next(StateName::MdxExpressionTextAfter), State::Nok);
+ State::Retry(StateName::MdxExpressionStart)
+ } else {
+ State::Nok
+ }
+}
+
+/// After an MDX expression (text) tag.
+///
+/// ```markdown
+/// > | a {Math.PI} c
+/// ^
+/// ```
+pub fn after(tokenizer: &mut Tokenizer) -> State {
+ tokenizer.tokenize_state.token_1 = Name::Data;
+ State::Ok
+}