From 25e267afbc0789ea36508d45c3ea3545b84223bb Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Thu, 18 Aug 2022 18:33:10 +0200 Subject: Add support for GFM autolink literals --- Untitled.txt | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) (limited to 'Untitled.txt') diff --git a/Untitled.txt b/Untitled.txt index 8238cf7..ca56d67 100644 --- a/Untitled.txt +++ b/Untitled.txt @@ -7,26 +7,22 @@ micromark.js: `atLineEnding` in html (text) should always eat arbitrary whitespa // --------------------- // Useful helper: -let mut index = 0; -let mut balance = 0; -println!("before: {:?}", events.len()); -while index < events.len() { - let event = &events[index]; - if event.event_type == EventType::Exit { - balance -= 1; + let mut index = 0; + let mut balance = 0; + println!("before: {:?}", tokenizer.events.len()); + while index < tokenizer.events.len() { + let event = &tokenizer.events[index]; + if event.kind == Kind::Exit { + balance -= 1; + } + let prefix = String::from_utf8(vec![b' '; balance * 2]).unwrap(); + println!( + "ev: {}{:?}:{:?} ({:?}): {:?}", + prefix, event.kind, event.name, index, event.link, + ); + if event.kind == Kind::Enter { + balance += 1; + } + index += 1; } - let prefix = String::from_utf8(vec![b' '; balance * 2]).unwrap(); - println!( - "ev: {}{:?}:{:?} ({:?}): {:?}", - prefix, - event.kind, - event.name, - index, - event.link, - ); - if event.event_type == EventType::Enter { - balance += 1; - } - index += 1; -} ``` -- cgit