Update newline handling to match latest CommonMark specification.

This commit is contained in:
David Anson 2019-09-14 13:53:35 -07:00
parent 65f6d38978
commit 220a1d78a9
3 changed files with 3 additions and 17 deletions

View file

@ -4,7 +4,7 @@
// Regular expression for matching common newline characters // Regular expression for matching common newline characters
// See NEWLINES_RE in markdown-it/lib/rules_core/normalize.js // See NEWLINES_RE in markdown-it/lib/rules_core/normalize.js
const newLineRe = /\r[\n\u0085]?|[\n\u2424\u2028\u0085]/; const newLineRe = /\r\n?|\n/;
module.exports.newLineRe = newLineRe; module.exports.newLineRe = newLineRe;
// Regular expression for matching common front matter (YAML and TOML) // Regular expression for matching common front matter (YAML and TOML)

View file

@ -1,6 +0,0 @@
# Heading
```text
hello
world
```

View file

@ -714,11 +714,7 @@ module.exports.stringInputLineEndings = function stringInputLineEndings(test) {
"cr": "One\rTwo\r#Three\n", "cr": "One\rTwo\r#Three\n",
"lf": "One\nTwo\n#Three\n", "lf": "One\nTwo\n#Three\n",
"crlf": "One\r\nTwo\r\n#Three\n", "crlf": "One\r\nTwo\r\n#Three\n",
"mixed": "One\rTwo\n#Three\n", "mixed": "One\rTwo\n#Three\n"
"crnel": "One\r\u0085Two\r\u0085#Three\n",
"snl": "One\u2424Two\u2424#Three\n",
"lsep": "One\u2028Two\u2028#Three\n",
"nel": "One\u0085Two\u0085#Three\n"
}, },
"config": defaultConfig, "config": defaultConfig,
"resultVersion": 0 "resultVersion": 0
@ -729,11 +725,7 @@ module.exports.stringInputLineEndings = function stringInputLineEndings(test) {
"cr": { "MD018": [ 3 ] }, "cr": { "MD018": [ 3 ] },
"lf": { "MD018": [ 3 ] }, "lf": { "MD018": [ 3 ] },
"crlf": { "MD018": [ 3 ] }, "crlf": { "MD018": [ 3 ] },
"mixed": { "MD018": [ 3 ] }, "mixed": { "MD018": [ 3 ] }
"crnel": { "MD018": [ 3 ] },
"snl": { "MD018": [ 3 ] },
"lsep": { "MD018": [ 3 ] },
"nel": { "MD018": [ 3 ] }
}; };
test.deepEqual(actualResult, expectedResult, "Undetected issues."); test.deepEqual(actualResult, expectedResult, "Undetected issues.");
test.done(); test.done();