Fix empty heading

This commit is contained in:
Laurenz 2022-05-04 23:33:40 +02:00
parent 1bca9ccecb
commit 15ef72cca4
5 changed files with 11 additions and 1 deletions

View File

@ -285,7 +285,7 @@ fn heading(p: &mut Parser, at_start: bool) {
while p.eat_if(NodeKind::Eq) {}
if at_start && p.peek().map_or(true, |kind| kind.is_space()) {
p.eat_while(|kind| kind.is_space());
p.eat_while(|kind| kind == &NodeKind::Space(0));
markup_line(p);
marker.end(p, NodeKind::Heading);
} else {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

@ -1,5 +1,11 @@
// Test headings.
---
#show node: heading as text(blue, node.body)
=
No heading
---
// Different number of equals signs.

View File

@ -1,5 +1,9 @@
// Test lists.
---
-
No list
---
_Shopping list_
#list(attached: true)[Apples][Potatoes][Juice]