diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-04-05 14:51:06 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-04-05 15:04:31 +0200 |
| commit | b865accae6c5e9f5d62afe4637c985c81b70eb4f (patch) | |
| tree | 752e0c3cc73b32b7ec16c1b26516610b79a29544 /src/parse/mod.rs | |
| parent | 2eacfcfa8121e1002db45232b343ce846c0c8b2f (diff) | |
Don't allow headings to span multiple lines
Diffstat (limited to 'src/parse/mod.rs')
| -rw-r--r-- | src/parse/mod.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/parse/mod.rs b/src/parse/mod.rs index 58b81521..55f2fd49 100644 --- a/src/parse/mod.rs +++ b/src/parse/mod.rs @@ -161,6 +161,11 @@ fn markup(p: &mut Parser, mut at_start: bool) { }); } +/// Parse a single line of markup. +fn markup_line(p: &mut Parser) { + markup_indented(p, usize::MAX); +} + /// Parse markup that stays right of the given `column`. fn markup_indented(p: &mut Parser, column: usize) { p.eat_while(|t| match t { @@ -272,8 +277,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()) { - let column = p.column(p.prev_end()); - markup_indented(p, column); + markup_line(p); marker.end(p, NodeKind::Heading); } else { let text = p.get(current_start .. p.prev_end()).into(); |
