diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-05-04 23:33:40 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-05-04 23:34:02 +0200 |
| commit | 15ef72cca427c63b2e545d645b49ff27aecffad6 (patch) | |
| tree | a9ec17c8be0b3f2f577907a4ccedd91fe853907e | |
| parent | 1bca9ccecb9edb583a0a94bd3611147b66909ab9 (diff) | |
Fix empty heading
| -rw-r--r-- | src/parse/mod.rs | 2 | ||||
| -rw-r--r-- | tests/ref/structure/heading.png | bin | 22641 -> 24525 bytes | |||
| -rw-r--r-- | tests/ref/structure/list.png | bin | 20169 -> 20656 bytes | |||
| -rw-r--r-- | tests/typ/structure/heading.typ | 6 | ||||
| -rw-r--r-- | tests/typ/structure/list.typ | 4 |
5 files changed, 11 insertions, 1 deletions
diff --git a/src/parse/mod.rs b/src/parse/mod.rs index b473c9af..86d18cba 100644 --- a/src/parse/mod.rs +++ b/src/parse/mod.rs @@ -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 { diff --git a/tests/ref/structure/heading.png b/tests/ref/structure/heading.png Binary files differindex 3e12b2cf..7ad228ab 100644 --- a/tests/ref/structure/heading.png +++ b/tests/ref/structure/heading.png diff --git a/tests/ref/structure/list.png b/tests/ref/structure/list.png Binary files differindex 7a60e1e5..5d0f03c0 100644 --- a/tests/ref/structure/list.png +++ b/tests/ref/structure/list.png diff --git a/tests/typ/structure/heading.typ b/tests/typ/structure/heading.typ index de95c35b..496181bd 100644 --- a/tests/typ/structure/heading.typ +++ b/tests/typ/structure/heading.typ @@ -1,6 +1,12 @@ // Test headings. --- +#show node: heading as text(blue, node.body) + += +No heading + +--- // Different number of equals signs. = Level 1 diff --git a/tests/typ/structure/list.typ b/tests/typ/structure/list.typ index 77e153c7..5c410a3f 100644 --- a/tests/typ/structure/list.typ +++ b/tests/typ/structure/list.typ @@ -1,6 +1,10 @@ // Test lists. --- +- +No list + +--- _Shopping list_ #list(attached: true)[Apples][Potatoes][Juice] |
