aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hard_break_trailing.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-06-30 16:35:13 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-06-30 16:35:13 +0200
commitbe62b2e29a61774100f676cfdd9b100cadf1905f (patch)
tree4349e259fc0150526dc32242b92d85218091fca5 /tests/hard_break_trailing.rs
parent13588776d65601a41ddfce85f618e8aaa55951cc (diff)
downloadmarkdown-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/hard_break_trailing.rs')
-rw-r--r--tests/hard_break_trailing.rs74
1 files changed, 34 insertions, 40 deletions
diff --git a/tests/hard_break_trailing.rs b/tests/hard_break_trailing.rs
index 6c29020..0dbbbdb 100644
--- a/tests/hard_break_trailing.rs
+++ b/tests/hard_break_trailing.rs
@@ -15,12 +15,11 @@ fn hard_break_trailing() {
"should support multiple trailing spaces"
);
- // To do: trimming whitespace in paragraphs.
- // assert_eq!(
- // micromark("foo \n bar"),
- // "<p>foo<br />\nbar</p>",
- // "should support leading spaces after a trailing hard break"
- // );
+ assert_eq!(
+ micromark("foo \n bar"),
+ "<p>foo<br />\nbar</p>",
+ "should support leading spaces after a trailing hard break"
+ );
// To do: attention.
// assert_eq!(
@@ -42,12 +41,11 @@ fn hard_break_trailing() {
"should not support trailing hard breaks in code"
);
- // To do: trimming whitespace in paragraphs.
- // assert_eq!(
- // micromark("foo "),
- // "<p>foo</p>",
- // "should not support trailing hard breaks at the end of a paragraph"
- // );
+ assert_eq!(
+ micromark("foo "),
+ "<p>foo</p>",
+ "should not support trailing hard breaks at the end of a paragraph"
+ );
assert_eq!(
micromark("### foo "),
@@ -55,26 +53,23 @@ fn hard_break_trailing() {
"should not support trailing hard breaks at the end of a heading"
);
- // To do: trimming whitespace in paragraphs.
- // assert_eq!(
- // micromark("aaa \t\nbb"),
- // "<p>aaa\nbb</p>",
- // "should support a mixed line suffix (1)"
- // );
+ assert_eq!(
+ micromark("aaa \t\nbb"),
+ "<p>aaa\nbb</p>",
+ "should support a mixed line suffix (1)"
+ );
- // To do: trimming whitespace in paragraphs.
- // assert_eq!(
- // micromark("aaa\t \nbb"),
- // "<p>aaa\nbb</p>",
- // "should support a mixed line suffix (2)"
- // );
+ assert_eq!(
+ micromark("aaa\t \nbb"),
+ "<p>aaa\nbb</p>",
+ "should support a mixed line suffix (2)"
+ );
- // To do: trimming whitespace in paragraphs.
- // assert_eq!(
- // micromark("aaa \t \nbb"),
- // "<p>aaa\nbb</p>",
- // "should support a mixed line suffix (3)"
- // );
+ assert_eq!(
+ micromark("aaa \t \nbb"),
+ "<p>aaa\nbb</p>",
+ "should support a mixed line suffix (3)"
+ );
assert_eq!(
micromark("aaa\0 \nbb"),
@@ -82,12 +77,11 @@ fn hard_break_trailing() {
"should support a hard break after a replacement character"
);
- // To do: trimming whitespace in paragraphs.
- // assert_eq!(
- // micromark("aaa\0\t\nbb"),
- // "<p>aaa�\nbb</p>",
- // "should support a line suffix after a replacement character"
- // );
+ assert_eq!(
+ micromark("aaa\0\t\nbb"),
+ "<p>aaa�\nbb</p>",
+ "should support a line suffix after a replacement character"
+ );
// To do: attention.
// assert_eq!(
@@ -96,28 +90,28 @@ fn hard_break_trailing() {
// "should support a hard break after a span"
// );
- // To do: attention, trimming whitespace in paragraphs.
+ // To do: attention.
// assert_eq!(
// micromark("*a*\t\nbb"),
// "<p><em>a</em>\nbb</p>",
// "should support a line suffix after a span"
// );
- // To do: attention, trimming whitespace in paragraphs.
+ // To do: attention.
// assert_eq!(
// micromark("*a* \t\nbb"),
// "<p><em>a</em>\nbb</p>",
// "should support a mixed line suffix after a span (1)"
// );
- // To do: attention, trimming whitespace in paragraphs.
+ // To do: attention.
// assert_eq!(
// micromark("*a*\t \nbb"),
// "<p><em>a</em>\nbb</p>",
// "should support a mixed line suffix after a span (2)"
// );
- // To do: attention, trimming whitespace in paragraphs.
+ // To do: attention.
// assert_eq!(
// micromark("*a* \t \nbb"),
// "<p><em>a</em>\nbb</p>",