mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 14:00:13 +01:00
Fix forEachInlineCodeSpan to handle lines ending with '\' better.
This commit is contained in:
parent
33cb1a71ec
commit
a5f03d02d0
3 changed files with 12 additions and 2 deletions
|
|
@ -319,7 +319,8 @@ module.exports.forEachInlineCodeSpan =
|
||||||
currentLine++;
|
currentLine++;
|
||||||
currentColumn = 0;
|
currentColumn = 0;
|
||||||
} else if ((char === "\\") &&
|
} else if ((char === "\\") &&
|
||||||
((startIndex === -1) || (startColumn === -1))) {
|
((startIndex === -1) || (startColumn === -1)) &&
|
||||||
|
(input[index + 1] !== "\n")) {
|
||||||
// Escape character outside code, skip next
|
// Escape character outside code, skip next
|
||||||
index++;
|
index++;
|
||||||
currentColumn += 2;
|
currentColumn += 2;
|
||||||
|
|
|
||||||
|
|
@ -66,3 +66,8 @@ text ` code {MD038}
|
||||||
span code
|
span code
|
||||||
span` text
|
span` text
|
||||||
text.
|
text.
|
||||||
|
|
||||||
|
"<!--"
|
||||||
|
-->
|
||||||
|
Text `code
|
||||||
|
code code `text` {MD038}
|
||||||
|
|
|
||||||
|
|
@ -1833,7 +1833,7 @@ module.exports.includesSorted = function includesSorted(test) {
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.forEachInlineCodeSpan = function forEachInlineCodeSpan(test) {
|
module.exports.forEachInlineCodeSpan = function forEachInlineCodeSpan(test) {
|
||||||
test.expect(94);
|
test.expect(99);
|
||||||
const testCases =
|
const testCases =
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
|
|
@ -1916,6 +1916,10 @@ module.exports.forEachInlineCodeSpan = function forEachInlineCodeSpan(test) {
|
||||||
[
|
[
|
||||||
"text \\` text `code`",
|
"text \\` text `code`",
|
||||||
[ [ "code", 0, 14, 1 ] ]
|
[ [ "code", 0, 14, 1 ] ]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"text\\\n`code`",
|
||||||
|
[ [ "code", 1, 1, 1 ] ]
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
testCases.forEach((testCase) => {
|
testCases.forEach((testCase) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue