Do not match headlines as plain list items.

This commit is contained in:
Tom Alexander 2023-10-17 15:35:43 -04:00
parent 364ba79517
commit b7442c1e92
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -102,6 +102,22 @@ pub(crate) fn detect_not_plain_list_item_indent<'b, 'g, 'r, 's>(
{ {
return Ok((input, indent)); 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."))); return Err(nom::Err::Error(CustomError::Static("No element detected.")));
} }