From 2cd3e65fd85b137f4951c5ccfdc259c06d49c80e Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Tue, 25 Oct 2022 12:07:04 +0200 Subject: Fix lists in MDX Closes GH-11. --- src/construct/mdx_expression_flow.rs | 2 +- tests/mdx_expression_flow.rs | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/construct/mdx_expression_flow.rs b/src/construct/mdx_expression_flow.rs index ef3ca41..bfb73de 100644 --- a/src/construct/mdx_expression_flow.rs +++ b/src/construct/mdx_expression_flow.rs @@ -49,7 +49,6 @@ use crate::util::constant::TAB_SIZE; pub fn start(tokenizer: &mut Tokenizer) -> State { if tokenizer.parse_state.options.constructs.mdx_expression_flow { tokenizer.tokenize_state.token_1 = Name::MdxFlowExpression; - tokenizer.concrete = true; if matches!(tokenizer.current, Some(b'\t' | b' ')) { tokenizer.attempt(State::Next(StateName::MdxExpressionFlowBefore), State::Nok); State::Retry(space_or_tab_min_max( @@ -77,6 +76,7 @@ pub fn start(tokenizer: &mut Tokenizer) -> State { /// ``` pub fn before(tokenizer: &mut Tokenizer) -> State { if Some(b'{') == tokenizer.current { + tokenizer.concrete = true; tokenizer.attempt(State::Next(StateName::MdxExpressionFlowAfter), State::Nok); State::Retry(StateName::MdxExpressionStart) } else { diff --git a/tests/mdx_expression_flow.rs b/tests/mdx_expression_flow.rs index 4281e5d..559e08c 100644 --- a/tests/mdx_expression_flow.rs +++ b/tests/mdx_expression_flow.rs @@ -95,6 +95,12 @@ fn mdx_expression_flow_agnostic() -> Result<(), String> { "should support expressions preceded by spaces" ); + assert_eq!( + to_html_with_options("a\n\n* b", &mdx)?, + "

a

\n", + "should support lists after non-expressions (GH-11)" + ); + assert_eq!( to_html_with_options("> {a\nb}", &mdx) .err() -- cgit