diff --git a/src/parser/text_element_parser.rs b/src/parser/text_element_parser.rs index 1e259bf9..01dff64d 100644 --- a/src/parser/text_element_parser.rs +++ b/src/parser/text_element_parser.rs @@ -118,6 +118,10 @@ pub fn context_paragraph_end<'s, 'r>( paragraph_end(input) } +pub fn context_bold_end<'s, 'r>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, &'s str> { + recognize(bold_end)(input) +} + pub fn paragraph<'s, 'r>( context: Context<'r, 's>, i: &'s str, @@ -170,11 +174,9 @@ fn flat_bold<'s, 'r>(context: Context<'r, 's>, i: &'s str) -> Res<&'s str, Bold< context.with_additional_node(ContextElement::FailMatcherNode(FailMatcherNode { fail_matcher: ChainBehavior::AndParent(Some(&recognize_bold_end)), })); - // let nom_context = context.with_additional_fail_matcher(&recognize_bold_end); - let text_element_parser = parser_with_context!(flat_text_element)(nom_context); let (remaining, captured) = recognize(tuple(( bold_start, - many_till(text_element_parser, bold_end), + |i| context_many_till(&nom_context, flat_text_element, context_bold_end)(i), )))(i)?; let ret = Bold { contents: captured }; Ok((remaining, ret))