diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-06-09 15:01:46 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-06-09 15:01:46 +0200 |
commit | 021d5f989ae41ae39a9b937b498141d9dc70d894 (patch) | |
tree | 8009a01d69cbd4f8200ffd34fc4031265b67406e /src/util.rs | |
parent | 344c3db875056d4aec509f24fb2dbeaf7e2a14b6 (diff) | |
download | markdown-rs-021d5f989ae41ae39a9b937b498141d9dc70d894.tar.gz markdown-rs-021d5f989ae41ae39a9b937b498141d9dc70d894.tar.bz2 markdown-rs-021d5f989ae41ae39a9b937b498141d9dc70d894.zip |
Add basic subtokenization, string content in fenced code
Diffstat (limited to '')
-rw-r--r-- | src/util.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/util.rs b/src/util.rs index 47359a3..5a916cd 100644 --- a/src/util.rs +++ b/src/util.rs @@ -165,12 +165,12 @@ pub fn get_span(events: &[Event], index: usize) -> Span { assert_eq!( exit.event_type, EventType::Exit, - "expected get_span to be called on `exit` event" + "expected `get_span` to be called on `exit` event" ); - let mut start_index = index - 1; + let mut enter_index = index - 1; loop { - let enter = &events[start_index]; + let enter = &events[enter_index]; if enter.event_type == EventType::Enter && enter.token_type == token_type { return Span { // start: enter.point.clone(), @@ -181,7 +181,7 @@ pub fn get_span(events: &[Event], index: usize) -> Span { }; } - start_index -= 1; + enter_index -= 1; } } |