Repository navigation
Commit 23b1706
authored
fix: do not add a newline to an empty code block (#4073)
* fix: do not add a newline to an empty code block
Renderer.code appended a newline unconditionally, so a code block with no
content rendered as <pre><code>\n</code></pre> instead of
<pre><code></code></pre>.
This fixes CommonMark examples 126, 130, 144 and 237. The spec suite did not
catch it because htmlIsEqual leaves html-differ's ignoreWhitespaces at its
default of true, and whitespace inside pre/code is significant, so all four
were already reported as passing.
* test: move the empty code block tests to test/specs/new
Uses renderExact so the fixture compares exactly, which htmlIsEqual
does not, and keeps the assertions out of marked.test.js.1 parent df57534 commit 23b1706
3 files changed
Lines changed: 30 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
0 commit comments