Fix bad list interaction

Fixes #87
This commit is contained in:
Laurenz 2022-09-26 16:25:40 +02:00
parent 704f2fbaf1
commit abafb39041
4 changed files with 15 additions and 9 deletions

View File

@ -413,6 +413,11 @@ impl<'a> Builder<'a> {
self.interrupt(Interruption::List, styles, false)?;
if let Content::Item(_) = content {
self.list.accept(content, styles);
return Ok(());
}
if self.par.accept(content, styles) {
return Ok(());
}

View File

@ -454,8 +454,8 @@ impl Marker {
/// Wrap all children after the marker (excluding trailing trivia) in a node
/// with the given `kind`.
pub fn end(self, p: &mut Parser, kind: NodeKind) {
let until = p.trivia_start();
let children = p.children.drain(self.0 .. until.0).collect();
let until = p.trivia_start().0.max(self.0);
let children = p.children.drain(self.0 .. until).collect();
p.children
.insert(self.0, InnerNode::with_children(kind, children).into());
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

@ -5,14 +5,9 @@
---
1. First.
2. Second.
2. Indented
1. Back to first.
---
2. Second
1. First
+ Indented
+ Second
---
// Test automatic numbering in summed content.
@ -35,6 +30,12 @@
+ A
+ B
---
// Mix of different lists
- List
+ Enum
/ Desc: List
---
// Test label closure.
#enum(