From b7442c1e92a1b8f1f34b42c724d45dc409ec866a Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Tue, 17 Oct 2023 15:35:43 -0400 Subject: [PATCH] Do not match headlines as plain list items. --- src/parser/plain_list.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/parser/plain_list.rs b/src/parser/plain_list.rs index 1d7549f..e47f297 100644 --- a/src/parser/plain_list.rs +++ b/src/parser/plain_list.rs @@ -102,6 +102,22 @@ pub(crate) fn detect_not_plain_list_item_indent<'b, 'g, 'r, 's>( { return Ok((input, indent)); } + + // Headlines are not plain list items. + if let Ok((_remaining, (_, indent, _))) = verify( + tuple(( + start_of_line, + parser_with_context!(indentation_level)(context), + tuple(( + parser_with_context!(bullet)(context), + alt((space1, line_ending, eof)), + )), + )), + |(_, (depth, bullet), (_, _))| *depth == 0 && Into::<&str>::into(bullet).starts_with('*'), + )(input) + { + return Ok((input, indent)); + } return Err(nom::Err::Error(CustomError::Static("No element detected."))); }