diff --git a/helpers/helpers.js b/helpers/helpers.js index d4729549..640d6150 100644 --- a/helpers/helpers.js +++ b/helpers/helpers.js @@ -319,7 +319,8 @@ module.exports.forEachInlineCodeSpan = currentLine++; currentColumn = 0; } else if ((char === "\\") && - ((startIndex === -1) || (startColumn === -1))) { + ((startIndex === -1) || (startColumn === -1)) && + (input[index + 1] !== "\n")) { // Escape character outside code, skip next index++; currentColumn += 2; diff --git a/test/line-breaks-inside-code-spans.md b/test/line-breaks-inside-code-spans.md index 76a69eaf..eff1e069 100644 --- a/test/line-breaks-inside-code-spans.md +++ b/test/line-breaks-inside-code-spans.md @@ -66,3 +66,8 @@ text ` code {MD038} span code span` text text. + +" +Text `code +code code `text` {MD038} diff --git a/test/markdownlint-test.js b/test/markdownlint-test.js index 05d84696..224968da 100644 --- a/test/markdownlint-test.js +++ b/test/markdownlint-test.js @@ -1833,7 +1833,7 @@ module.exports.includesSorted = function includesSorted(test) { }; module.exports.forEachInlineCodeSpan = function forEachInlineCodeSpan(test) { - test.expect(94); + test.expect(99); const testCases = [ [ @@ -1916,6 +1916,10 @@ module.exports.forEachInlineCodeSpan = function forEachInlineCodeSpan(test) { [ "text \\` text `code`", [ [ "code", 0, 14, 1 ] ] + ], + [ + "text\\\n`code`", + [ [ "code", 1, 1, 1 ] ] ] ]; testCases.forEach((testCase) => {