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/misc_tabs.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/misc_tabs.rs')
-rw-r--r-- | tests/misc_tabs.rs | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/tests/misc_tabs.rs b/tests/misc_tabs.rs index 568172e..e82738d 100644 --- a/tests/misc_tabs.rs +++ b/tests/misc_tabs.rs @@ -204,22 +204,20 @@ fn tabs_text() { "should support a space starting, and a tab ending, code" ); - // To do: trim trailing whitespace. - // // Note: CM does not strip it in this case. - // // However, that should be a bug there: makes more sense to remove it like - // // trailing spaces. - // assert_eq!( - // micromark("x\t\ny"), - // "<p>x\ny</p>", - // "should support a trailing tab at a line ending in a paragraph" - // ); - - // To do: trim trailing whitespace. - // assert_eq!( - // micromark("x\n\ty"), - // "<p>x\ny</p>", - // "should support an initial tab after a line ending in a paragraph" - // ); + // Note: CM does not strip it in this case. + // However, that should be a bug there: makes more sense to remove it like + // trailing spaces. + assert_eq!( + micromark("x\t\ny"), + "<p>x\ny</p>", + "should support a trailing tab at a line ending in a paragraph" + ); + + assert_eq!( + micromark("x\n\ty"), + "<p>x\ny</p>", + "should support an initial tab after a line ending in a paragraph" + ); assert_eq!( micromark("x[\ty](z)"), |