Skip to content

Commit

Permalink
Merge pull request #862 from notriddle/notriddle/indent-relativity
Browse files Browse the repository at this point in the history
Check indentation on the closing fence relative to the line
  • Loading branch information
Martin1887 committed Mar 6, 2024
2 parents b862fb8 + cd841e3 commit 4ba4738
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
17 changes: 17 additions & 0 deletions pulldown-cmark/specs/regression.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2525,3 +2525,20 @@ title
junk</p>
</blockquote>
````````````````````````````````

ISSUE 861

```````````````````````````````` example
~~~
~~~
.
<pre><code> ~~~
</code></pre>
````````````````````````````````

```````````````````````````````` example
~~~
~~~
.
<pre><code></code></pre>
````````````````````````````````
2 changes: 1 addition & 1 deletion pulldown-cmark/src/firstpass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1148,7 +1148,7 @@ impl<'a, 'b> FirstPass<'a, 'b> {
}
line_start.scan_space(indent);
let mut close_line_start = line_start.clone();
if !close_line_start.scan_space(4) {
if !close_line_start.scan_space(4 - indent) {
let close_ix = ix + close_line_start.bytes_scanned();
if let Some(n) = scan_closing_code_fence(&bytes[close_ix..], fence_ch, n_fence_char)
{
Expand Down
23 changes: 23 additions & 0 deletions pulldown-cmark/tests/suite/regression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3016,3 +3016,26 @@ junk</p>

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

#[test]
fn regression_test_191() {
let original = r##" ~~~
~~~
"##;
let expected = r##"<pre><code> ~~~
</code></pre>
"##;

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

#[test]
fn regression_test_192() {
let original = r##" ~~~
~~~
"##;
let expected = r##"<pre><code></code></pre>
"##;

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

0 comments on commit 4ba4738

Please sign in to comment.