Skip to content

Commit

Permalink
Merge branch 'raphlinus:master' into zig-release
Browse files Browse the repository at this point in the history
  • Loading branch information
phoepsilonix committed Jan 17, 2024
2 parents 2358fd7 + 2c8d651 commit 6d695cb
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 2 deletions.
38 changes: 38 additions & 0 deletions specs/regression.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2116,3 +2116,41 @@ baz`</li>
baz](https://example.com)</li>
</ul>
````````````````````````````````

ISSUE 808

```````````````````````````````` example
[mylink]

[mylink]: https://example.com
'
part of the title'
.
<p><a href="https://example.com" title="
part of the title">mylink</a></p>
````````````````````````````````

ISSUE 810

```````````````````````````````` example
1.
pulldown-cmark used to think this was code, but commonmark.js and commonmark-hs didn't.
The dot in the list marker is at column two, so the child paragraph actually
starts in column *three*.
.
<ol>
<li>pulldown-cmark used to think this was code, but commonmark.js and commonmark-hs didn't.
The dot in the list marker is at column two, so the child paragraph actually
starts in column <em>three</em>.</li>
</ol>
````````````````````````````````

```````````````````````````````` example
1.
This is not in the list at all. It's a paragraph after it.
.
<ol>
<li></li>
</ol>
<p>This is not in the list at all. It's a paragraph after it.</p>
````````````````````````````````
7 changes: 6 additions & 1 deletion src/firstpass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1520,7 +1520,12 @@ impl<'a, 'b> FirstPass<'a, 'b> {
}
}
c if c == closing_delim => {
let cow = linebuf.map(CowStr::from).unwrap_or(CowStr::from(&text[linestart..bytecount]));
let cow = if let Some(mut linebuf) = linebuf {
linebuf.push_str(&text[linestart..bytecount]);
CowStr::from(linebuf)
} else {
CowStr::from(&text[linestart..bytecount])
};
return Some((bytecount + 1, cow));
}
_ => {
Expand Down
2 changes: 1 addition & 1 deletion src/scanners.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ impl<'a> LineStart<'a> {
} else if c == b')' || c == b'.' {
self.ix = ix;
if self.scan_space(1) || self.is_at_eol() {
return self.finish_list_marker(c, val, indent + self.ix - start_ix);
return self.finish_list_marker(c, val, indent + 1 + ix - start_ix);
} else {
break;
}
Expand Down
48 changes: 48 additions & 0 deletions tests/suite/regression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2492,3 +2492,51 @@ baz](https://example.com)</li>

test_markdown_html(original, expected, false, false, false);
}


#[test]
fn regression_test_154() {
let original = r##"[mylink]
[mylink]: https://example.com
'
part of the title'
"##;
let expected = r##"<p><a href="https://example.com" title="
part of the title">mylink</a></p>
"##;

test_markdown_html(original, expected, false, false, false);
}

#[test]
fn regression_test_155() {
let original = r##"1.
pulldown-cmark used to think this was code, but commonmark.js and commonmark-hs didn't.
The dot in the list marker is at column two, so the child paragraph actually
starts in column *three*.
"##;
let expected = r##"<ol>
<li>pulldown-cmark used to think this was code, but commonmark.js and commonmark-hs didn't.
The dot in the list marker is at column two, so the child paragraph actually
starts in column <em>three</em>.</li>
</ol>
"##;

test_markdown_html(original, expected, false, false, false);
}

#[test]
fn regression_test_156() {
let original = r##"1.
This is not in the list at all. It's a paragraph after it.
"##;
let expected = r##"<ol>
<li></li>
</ol>
<p>This is not in the list at all. It's a paragraph after it.</p>
"##;

test_markdown_html(original, expected, false, false, false);
}

0 comments on commit 6d695cb

Please sign in to comment.