Skip to content

Commit

Permalink
Fix lists in MDX
Browse files Browse the repository at this point in the history
Closes GH-11.
  • Loading branch information
wooorm committed Oct 25, 2022
1 parent 74ec046 commit 2cd3e65
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/construct/mdx_expression_flow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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 {
Expand Down
6 changes: 6 additions & 0 deletions tests/mdx_expression_flow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?,
"<p>a</p>\n<ul>\n<li>b</li>\n</ul>",
"should support lists after non-expressions (GH-11)"
);

assert_eq!(
to_html_with_options("> {a\nb}", &mdx)
.err()
Expand Down

0 comments on commit 2cd3e65

Please sign in to comment.