aboutsummaryrefslogtreecommitdiffstats
path: root/src/construct/document.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-09-12 13:50:48 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-09-12 13:54:43 +0200
commit2011d2ea4d6ec9d1bd7409c22e4258aceaaa3afe (patch)
treee462579538174cb983dcc2be4b0418b8c5077050 /src/construct/document.rs
parent640c103c0a2b92f7f2a49cfc0721577f40aa90e0 (diff)
downloadmarkdown-rs-2011d2ea4d6ec9d1bd7409c22e4258aceaaa3afe.tar.gz
markdown-rs-2011d2ea4d6ec9d1bd7409c22e4258aceaaa3afe.tar.bz2
markdown-rs-2011d2ea4d6ec9d1bd7409c22e4258aceaaa3afe.zip
Fix whitespace in GFM footnote definition identifiers
* Fix a crash on line endings in footnote definitions * Fix to match spaces and tabs in identifiers to `cmark-gfm` * Fix order of one attribute
Diffstat (limited to 'src/construct/document.rs')
-rw-r--r--src/construct/document.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/construct/document.rs b/src/construct/document.rs
index 57c5f3a..45a961d 100644
--- a/src/construct/document.rs
+++ b/src/construct/document.rs
@@ -567,11 +567,20 @@ fn resolve(tokenizer: &mut Tokenizer) {
child.map.consume(&mut child.events);
+ let mut flow_index = skip::to(&tokenizer.events, 0, &[Name::Data]);
+ while flow_index < tokenizer.events.len()
+ // To do: use `!is_some_and()` when that’s stable.
+ && (tokenizer.events[flow_index].link.is_none()
+ || tokenizer.events[flow_index].link.as_ref().unwrap().content != Content::Flow)
+ {
+ flow_index = skip::to(&tokenizer.events, flow_index + 1, &[Name::Data]);
+ }
+
// Now, add all child events into our parent document tokenizer.
divide_events(
&mut tokenizer.map,
&tokenizer.events,
- skip::to(&tokenizer.events, 0, &[Name::Data]),
+ flow_index,
&mut child.events,
);