Support blank lines for descriptive list with empty value before final list item.

This commit is contained in:
Tom Alexander 2023-09-21 22:03:21 -04:00
parent dc5695ec9f
commit f0a7493a89
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
3 changed files with 12 additions and 6 deletions

View File

@ -9,8 +9,3 @@
- big gap :: - big gap ::
stuff stuff
- empty value with blank non-final ::
- empty value with blank final ::
stuff

View File

@ -0,0 +1,6 @@
- foo ::
- bar ::
baz

View File

@ -187,7 +187,11 @@ fn plain_list_item<'b, 'g, 'r, 's>(
)(&parser_context))(remaining); )(&parser_context))(remaining);
match maybe_contentless_item { match maybe_contentless_item {
Ok((_rem, _ws)) => { Ok((_rem, _ws)) => {
let (remaining, _trailing_ws) = opt(blank_line)(remaining)?; let (remaining, _trailing_ws) = if context.should_consume_trailing_whitespace() {
recognize(many0(blank_line))(remaining)?
} else {
recognize(opt(blank_line))(remaining)?
};
let source = get_consumed(input, remaining); let source = get_consumed(input, remaining);
return Ok(( return Ok((
remaining, remaining,
@ -245,6 +249,7 @@ fn plain_list_item<'b, 'g, 'r, 's>(
)); ));
} }
#[derive(Debug)]
enum BulletType { enum BulletType {
Ordered, Ordered,
Unordered, Unordered,