Repository navigation
Commit 123ce04
authored
fix: drop the leading whitespace after a hard line break (#4075)
* fix: drop the leading whitespace after a hard line break
CommonMark ignores leading spaces at the start of the line following a hard
line break. The br rule consumed the break but not that indentation, so it
stayed on the following text token.
Fixes CommonMark examples 636 and 637. Neither marked's differ nor an exact
comparison can see this: the differ ignores whitespace, and exact still
differs on <br> versus <br />. Under the spec's own normalize.py the count
goes from 28 to 26.
* fix: also drop a leading tab after a hard line break
The rule only consumed spaces, so a continuation line indented with a
tab kept it. Both the reference implementation and markdown-it drop
tabs there as well.
* test: move the hard line break tests to test/specs/new
Uses renderExact so the fixture compares exactly, which htmlIsEqual
does not, and the assertions keep their teeth outside marked.test.js.1 parent dbb393d commit 123ce04
3 files changed
Lines changed: 29 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
283 | 283 | | |
284 | 284 | | |
285 | 285 | | |
286 | | - | |
| 286 | + | |
287 | 287 | | |
288 | 288 | | |
289 | 289 | | |
| |||
| 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