From be62b2e29a61774100f676cfdd9b100cadf1905f Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Thu, 30 Jun 2022 16:35:13 +0200 Subject: Add support for trimming whitespace around string, text This commit introduces trimming initial and final whitespace around the whole string or text, or around line endings inside that string or text. * Add `register_resolver_before`, to run resolvers earlier than others, used for labels * Add resolver to merge `data` events, which are the most frequent token that occurs, and can happen adjacently. In `micromark-js` this sped up parsing a lot * Fix a bug where a virtual space was not seen as an okay event * Refactor to enable all turned off whitespace tests --- src/construct/label_start_image.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/construct/label_start_image.rs') diff --git a/src/construct/label_start_image.rs b/src/construct/label_start_image.rs index 7725334..a45205a 100644 --- a/src/construct/label_start_image.rs +++ b/src/construct/label_start_image.rs @@ -67,7 +67,7 @@ pub fn open(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { balanced: false, inactive: false, }); - tokenizer.register_resolver("media".to_string(), Box::new(resolve_media)); + tokenizer.register_resolver_before("media".to_string(), Box::new(resolve_media)); (State::Ok, None) } _ => (State::Nok, None), -- cgit