diff --git a/src/parser/paragraph.rs b/src/parser/paragraph.rs index ea97408d..e0a12356 100644 --- a/src/parser/paragraph.rs +++ b/src/parser/paragraph.rs @@ -37,8 +37,7 @@ pub fn paragraph<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s st |(children, _exit_contents)| !children.is_empty(), )(input)?; - // Check if a parent exit matcher is causing the exit - exit_matcher_parser(context, remaining)?; + // Not checking parent exit matcher because if there are any children matched then we have a valid paragraph. let (remaining, _trailing_ws) = if context.should_consume_trailing_whitespace() { opt(parser_with_context!(element_trailing_whitespace)( @@ -79,8 +78,9 @@ mod tests { let document_context = initial_context.with_additional_node(ContextElement::DocumentRoot(input)); let paragraph_matcher = parser_with_context!(paragraph)(&document_context); - let (remaining, first_paragraph) = paragraph_matcher(input).unwrap(); - let (remaining, second_paragraph) = paragraph_matcher(remaining).unwrap(); + let (remaining, first_paragraph) = paragraph_matcher(input).expect("Parse first paragraph"); + let (remaining, second_paragraph) = + paragraph_matcher(remaining).expect("Parse second paragraph."); assert_eq!(remaining, ""); assert_eq!(first_paragraph.source, "foo bar baz\n\n"); assert_eq!(second_paragraph.source, "lorem ipsum");