aboutsummaryrefslogtreecommitdiffstats
path: root/src/construct/flow.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-09-08 15:46:46 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-09-08 16:30:56 +0200
commitb4256dc2e1352a2b74f29b2650150cc8b57f54ed (patch)
tree67ddb1b3c99be459fd0fa1ea19b5f89565e56b65 /src/construct/flow.rs
parent2d24336c61e88e364e63e36db7b0803bc6532159 (diff)
downloadmarkdown-rs-b4256dc2e1352a2b74f29b2650150cc8b57f54ed.tar.gz
markdown-rs-b4256dc2e1352a2b74f29b2650150cc8b57f54ed.tar.bz2
markdown-rs-b4256dc2e1352a2b74f29b2650150cc8b57f54ed.zip
Add support for mdx jsx (flow)
Diffstat (limited to 'src/construct/flow.rs')
-rw-r--r--src/construct/flow.rs19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/construct/flow.rs b/src/construct/flow.rs
index 3f7bc9c..5b2cbfe 100644
--- a/src/construct/flow.rs
+++ b/src/construct/flow.rs
@@ -16,6 +16,7 @@
//! * [Heading (atx)][crate::construct::heading_atx]
//! * [Heading (setext)][crate::construct::heading_setext]
//! * [HTML (flow)][crate::construct::html_flow]
+//! * [MDX JSX (flow)][crate::construct::mdx_jsx_flow]
//! * [Raw (flow)][crate::construct::raw_flow] (code (fenced), math (flow))
//! * [Thematic break][crate::construct::thematic_break]
@@ -61,7 +62,7 @@ pub fn start(tokenizer: &mut Tokenizer) -> State {
Some(b'<') => {
tokenizer.attempt(
State::Next(StateName::FlowAfter),
- State::Next(StateName::FlowBeforeParagraph),
+ State::Next(StateName::FlowBeforeMdxJsx),
);
State::Retry(StateName::HtmlFlowStart)
}
@@ -123,11 +124,25 @@ pub fn before_raw(tokenizer: &mut Tokenizer) -> State {
pub fn before_html(tokenizer: &mut Tokenizer) -> State {
tokenizer.attempt(
State::Next(StateName::FlowAfter),
- State::Next(StateName::FlowBeforeHeadingAtx),
+ State::Next(StateName::FlowBeforeMdxJsx),
);
State::Retry(StateName::HtmlFlowStart)
}
+/// At mdx jsx (flow).
+///
+/// ```markdown
+/// > | <A />
+/// ^
+/// ```
+pub fn before_mdx_jsx(tokenizer: &mut Tokenizer) -> State {
+ tokenizer.attempt(
+ State::Next(StateName::FlowAfter),
+ State::Next(StateName::FlowBeforeHeadingAtx),
+ );
+ State::Retry(StateName::MdxJsxFlowStart)
+}
+
/// At heading (atx).
///
/// ```markdown