aboutsummaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-08-22 16:16:59 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-08-22 16:16:59 +0200
commit8774b207b7251730eaa7fbfe4f144122a472dda0 (patch)
treece1b8f92a08ff70da265ae8e4484dba2335280a9 /src/util
parent351c69644bdbdf52c95e322904273657892920b5 (diff)
downloadmarkdown-rs-8774b207b7251730eaa7fbfe4f144122a472dda0.tar.gz
markdown-rs-8774b207b7251730eaa7fbfe4f144122a472dda0.tar.bz2
markdown-rs-8774b207b7251730eaa7fbfe4f144122a472dda0.zip
Add support for GFM task list item
Diffstat (limited to '')
-rw-r--r--src/util/skip.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/util/skip.rs b/src/util/skip.rs
index a7de408..df63498 100644
--- a/src/util/skip.rs
+++ b/src/util/skip.rs
@@ -59,12 +59,20 @@ fn skip_opt_impl(events: &[Event], mut index: usize, names: &[Name], forward: bo
balance - 1
};
+ let next = if forward {
+ index + 1
+ } else if index > 0 {
+ index - 1
+ } else {
+ index
+ };
+
if events[index].name == *current && balance == 0 {
- index = if forward { index + 1 } else { index - 1 };
+ index = next;
break;
}
- index = if forward { index + 1 } else { index - 1 };
+ index = next;
}
}