aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/construct/partial_data.rs2
-rw-r--r--src/construct/partial_whitespace.rs2
-rw-r--r--tests/fuzz.rs18
3 files changed, 22 insertions, 0 deletions
diff --git a/src/construct/partial_data.rs b/src/construct/partial_data.rs
index a27730c..fcd142d 100644
--- a/src/construct/partial_data.rs
+++ b/src/construct/partial_data.rs
@@ -74,6 +74,8 @@ pub fn inside(tokenizer: &mut Tokenizer) -> State {
/// Merge adjacent data events.
pub fn resolve(tokenizer: &mut Tokenizer) -> Option<Subresult> {
+ tokenizer.map.consume(&mut tokenizer.events);
+
let mut index = 0;
// Loop through events and merge adjacent data events.
diff --git a/src/construct/partial_whitespace.rs b/src/construct/partial_whitespace.rs
index bb25075..8e58838 100644
--- a/src/construct/partial_whitespace.rs
+++ b/src/construct/partial_whitespace.rs
@@ -67,6 +67,8 @@ use alloc::vec;
/// Resolve whitespace.
pub fn resolve_whitespace(tokenizer: &mut Tokenizer, hard_break: bool, trim_whole: bool) {
+ tokenizer.map.consume(&mut tokenizer.events);
+
let mut index = 0;
while index < tokenizer.events.len() {
diff --git a/tests/fuzz.rs b/tests/fuzz.rs
index 8d64ff2..a4a6765 100644
--- a/tests/fuzz.rs
+++ b/tests/fuzz.rs
@@ -30,5 +30,23 @@ fn fuzz() -> Result<(), String> {
"3-b: containers should not pierce into indented code"
);
+ assert_eq!(
+ to_html("a * "),
+ "<p>a *</p>",
+ "4-a: trailing whitespace and broken data"
+ );
+
+ assert_eq!(
+ to_html("_ "),
+ "<p>_</p>",
+ "4-b: trailing whitespace and broken data"
+ );
+
+ assert_eq!(
+ to_html_with_options("a ~ ", &Options::gfm())?,
+ "<p>a ~</p>",
+ "4-c: trailing whitespace and broken data"
+ );
+
Ok(())
}