diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-06-30 16:35:13 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-06-30 16:35:13 +0200 |
commit | be62b2e29a61774100f676cfdd9b100cadf1905f (patch) | |
tree | 4349e259fc0150526dc32242b92d85218091fca5 /tests/link_reference.rs | |
parent | 13588776d65601a41ddfce85f618e8aaa55951cc (diff) | |
download | markdown-rs-be62b2e29a61774100f676cfdd9b100cadf1905f.tar.gz markdown-rs-be62b2e29a61774100f676cfdd9b100cadf1905f.tar.bz2 markdown-rs-be62b2e29a61774100f676cfdd9b100cadf1905f.zip |
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
Diffstat (limited to 'tests/link_reference.rs')
-rw-r--r-- | tests/link_reference.rs | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/tests/link_reference.rs b/tests/link_reference.rs index 0904995..372bea5 100644 --- a/tests/link_reference.rs +++ b/tests/link_reference.rs @@ -66,7 +66,7 @@ fn link_reference() { ); assert_eq!( - micromark_with_options("[ref]: /uri\n\n[foo <bar attr=\"][ref]\">", &DANGER), + micromark_with_options("[ref]: /uri\n\n[foo <bar attr=\"][ref]\">", DANGER), "<p>[foo <bar attr=\"][ref]\"></p>", "should prefer HTML over link references" ); @@ -161,12 +161,11 @@ fn link_reference() { "should not support empty references" ); - // To do: trimming whitespace. - // assert_eq!( - // micromark("[\n ]: /uri\n\n[\n ]"), - // "<p>[\n]: /uri</p>\n<p>[\n]</p>", - // "should not support blank references" - // ); + assert_eq!( + micromark("[\n ]: /uri\n\n[\n ]"), + "<p>[\n]: /uri</p>\n<p>[\n]</p>", + "should not support blank references" + ); assert_eq!( micromark("[foo]: /url \"title\"\n\n[foo][]"), @@ -187,12 +186,11 @@ fn link_reference() { "should match references to definitions case-insensitively" ); - // To do: trimming whitespace. - // assert_eq!( - // micromark("[foo]: /url \"title\"\n\n[foo] \n[]"), - // "<p><a href=\"/url\" title=\"title\">foo</a>\n[]</p>", - // "should not support whitespace between label and collaped reference" - // ); + assert_eq!( + micromark("[foo]: /url \"title\"\n\n[foo] \n[]"), + "<p><a href=\"/url\" title=\"title\">foo</a>\n[]</p>", + "should not support whitespace between label and collaped reference" + ); assert_eq!( micromark("[foo]: /url \"title\"\n\n[foo]"), |