mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 06:20:12 +01:00
Update MD009/no-trailing-spaces to allow trailing spaces in fenced code blocks (fixes #292).
This commit is contained in:
parent
6c1bc8ecb5
commit
bd63c57fde
4 changed files with 45 additions and 10 deletions
|
|
@ -47,12 +47,10 @@ module.exports = {
|
|||
codeInlineLineNumbers.sort(numericSortAscending);
|
||||
}
|
||||
const expected = (brSpaces < 2) ? 0 : brSpaces;
|
||||
let inFencedCode = 0;
|
||||
forEachLine(lineMetadata(), (line, lineIndex, inCode, onFence) => {
|
||||
inFencedCode += onFence;
|
||||
forEachLine(lineMetadata(), (line, lineIndex, inCode) => {
|
||||
const lineNumber = lineIndex + 1;
|
||||
const trailingSpaces = line.length - line.trimRight().length;
|
||||
if ((!inCode || inFencedCode) && trailingSpaces &&
|
||||
if (trailingSpaces && !inCode &&
|
||||
!includesSorted(listItemLineNumbers, lineNumber)) {
|
||||
if ((expected !== trailingSpaces) ||
|
||||
(strict &&
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue