Repository: pulldown-cmark/pulldown-cmark (rust)

Issue:
[fuzz result] only four spaces trimmed after line break in link title
Consider this markdown:

```markdown
[link]: destination "
          text          "

[link]
```

It's another place where pulldown-cmark diverges from most other implementations. The [dingus](https://spec.commonmark.org/dingus/?text=%0A%5Blink%5D%3A%20destination%20%22%0A%20%20%20%20%20%20%20%20%20%20text%20%20%20%20%20%20%20%20%20%20%22%0A%0A%5Blink%5D%0A) thinks there's ten spaces after the word "text", but no spaces before it. [markdown-it](https://markdown-it.github.io/#md3=%7B%22source%22%3A%22%5Cn%5Blink%5D%3A%20destination%20%5C%22%5Cn%20%20%20%20%20%20%20%20%20%20text%20%20%20%20%20%20%20%20%20%20%5C%22%5Cn%5Cn%5Blink%5D%5Cn%22%2C%22defaults%22%3A%7B%22html%22%3Afalse%2C%22xhtmlOut%22%3Afalse%2C%22breaks%22%3Afalse%2C%22langPrefix%22%3A%22language-%22%2C%22linkify%22%3Atrue%2C%22typographer%22%3Atrue%2C%22_highlight%22%3Atrue%2C%22_strict%22%3Atrue%2C%22_view%22%3A%22src%22%7D%7D), [commonmark-hs](https://pandoc.org/try/?params=%7B%22text%22%3A%22%5Cn%5Blink%5D%3A+destination+%5C%22%5Cn++++++++++text++++++++++%5C%22%5Cn%5Cn%5Blink%5D%5Cn%22%2C%22to%22%3A%22html5%22%2C%22from%22%3A%22commonmark%22%2C%22standalone%22%3Afalse%2C%22embed-resources%22%3Afalse%2C%22table-of-contents%22%3Afalse%2C%22number-sections%22%3Afalse%2C%22citeproc%22%3Afalse%2C%22html-math-method%22%3A%22plain%22%2C%22wrap%22%3A%22auto%22%2C%22highlight-style%22%3Anull%2C%22files%22%3A%7B%7D%2C%22template%22%3Anull%7D), and GFM all seem to agree.

In other words, they all make this HTML:

```html
<p><a href="destination" title="
text          ">link</a></p>
```

The exception is goldmark. It does this:

```html
<p><a href="destination" title="
          text          ">link</a></p>
```

pulldown-cmark does this:

```html
<p><a href="destination" title="
      text          ">link</a></p>
```


Pull request description:
Eat all spaces after line break in link title
Fixes #867

Patch:
diff --git a/pulldown-cmark/specs/regression.txt b/pulldown-cmark/specs/regression.txt
index daf90c8..c239cb8 100644
--- a/pulldown-cmark/specs/regression.txt
+++ b/pulldown-cmark/specs/regression.txt
@@ -2542,3 +2542,15 @@ ISSUE 861
 .
 <pre><code></code></pre>
 ````````````````````````````````
+
+ISSUE 867
+
+```````````````````````````````` example
+[link]: destination "
+          text          "
+
+[link]
+.
+<p><a href="destination" title="
+text          ">link</a></p>
+````````````````````````````````
diff --git a/pulldown-cmark/src/firstpass.rs b/pulldown-cmark/src/firstpass.rs
index ff50ad2..614d9d5 100644
--- a/pulldown-cmark/src/firstpass.rs
+++ b/pulldown-cmark/src/firstpass.rs
@@ -1634,6 +1634,7 @@ impl<'a, 'b> FirstPass<'a, 'b> {
                             return None;
                         }
                     }
+                    line_start.scan_all_space();
                     bytecount += line_start.bytes_scanned();
                     linestart = bytecount;
                     if scan_blank_line(&bytes[bytecount..]).is_some() {


Test patch:
diff --git a/pulldown-cmark/tests/suite/regression.rs b/pulldown-cmark/tests/suite/regression.rs
index 41f2568..3628303 100644
--- a/pulldown-cmark/tests/suite/regression.rs
+++ b/pulldown-cmark/tests/suite/regression.rs
@@ -3039,3 +3039,17 @@ fn regression_test_192() {
 
     test_markdown_html(original, expected, false, false, false);
 }
+
+#[test]
+fn regression_test_193() {
+    let original = r##"[link]: destination "
+          text          "
+
+[link]
+"##;
+    let expected = r##"<p><a href="destination" title="
+text          ">link</a></p>
+"##;
+
+    test_markdown_html(original, expected, false, false, false);
+}