diff --git a/lib/md009.js b/lib/md009.js index dfe9c59b..0fef5a88 100644 --- a/lib/md009.js +++ b/lib/md009.js @@ -34,7 +34,7 @@ module.exports = { forEachLine(lineMetadata(), (line, lineIndex, inCode, onFence) => { inFencedCode += onFence; const lineNumber = lineIndex + 1; - if ((!inCode || inFencedCode !== 0) && trailingSpaceRe.test(line) && + if ((!inCode || inFencedCode) && trailingSpaceRe.test(line) && !includesSorted(listItemLineNumbers, lineNumber)) { const actual = line.length - line.trimRight().length; if (expected !== actual) { diff --git a/test/code_block_fenced.md b/test/code_block_fenced.md index c893670e..047264c5 100644 --- a/test/code_block_fenced.md +++ b/test/code_block_fenced.md @@ -12,7 +12,7 @@ This is a code block that won't trigger. ```text This is code -with an empty line. +with a line with trailing spaces. {MD009:14} ``` But we'll do another: @@ -21,4 +21,3 @@ But we'll do another: will. Final text is here -{MD009:14} diff --git a/test/trailing_spaces_br.md b/test/trailing_spaces_br.md index 861de197..826fce7b 100644 --- a/test/trailing_spaces_br.md +++ b/test/trailing_spaces_br.md @@ -1,6 +1,6 @@ This line has a single trailing space {MD009} This line has two trailing spaces and should be allowed This line has three trailing spaces {MD009} - -{MD009:4} This line has four trailing spaces {MD009} + +{MD009:5}