mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 22:40:13 +01:00
Update MD009/no-trailing-spaces with code_blocks parameter to allow reporting/fixing trailing spaces in indented/fenced code blocks (fixes #1181).
Some checks are pending
Checkers / linkcheck (push) Waiting to run
Checkers / spellcheck (push) Waiting to run
CI / build (20, macos-latest) (push) Waiting to run
CI / build (20, ubuntu-latest) (push) Waiting to run
CI / build (20, windows-latest) (push) Waiting to run
CI / build (22, macos-latest) (push) Waiting to run
CI / build (22, ubuntu-latest) (push) Waiting to run
CI / build (22, windows-latest) (push) Waiting to run
CI / build (24, macos-latest) (push) Waiting to run
CI / build (24, ubuntu-latest) (push) Waiting to run
CI / build (24, windows-latest) (push) Waiting to run
CI / pnpm (push) Waiting to run
CodeQL / Analyze (push) Waiting to run
TestRepos / build (latest, ubuntu-latest) (push) Waiting to run
UpdateTestRepos / update (push) Waiting to run
Some checks are pending
Checkers / linkcheck (push) Waiting to run
Checkers / spellcheck (push) Waiting to run
CI / build (20, macos-latest) (push) Waiting to run
CI / build (20, ubuntu-latest) (push) Waiting to run
CI / build (20, windows-latest) (push) Waiting to run
CI / build (22, macos-latest) (push) Waiting to run
CI / build (22, ubuntu-latest) (push) Waiting to run
CI / build (22, windows-latest) (push) Waiting to run
CI / build (24, macos-latest) (push) Waiting to run
CI / build (24, ubuntu-latest) (push) Waiting to run
CI / build (24, windows-latest) (push) Waiting to run
CI / pnpm (push) Waiting to run
CodeQL / Analyze (push) Waiting to run
TestRepos / build (latest, ubuntu-latest) (push) Waiting to run
UpdateTestRepos / update (push) Waiting to run
This commit is contained in:
parent
7beb9fc9d0
commit
a55d5499e2
16 changed files with 590 additions and 34 deletions
|
|
@ -13,14 +13,18 @@ export default {
|
|||
"function": function MD009(params, onError) {
|
||||
let brSpaces = params.config.br_spaces;
|
||||
brSpaces = Number((brSpaces === undefined) ? 2 : brSpaces);
|
||||
const codeBlocks = params.config.code_blocks;
|
||||
const includeCode = (codeBlocks === undefined) ? false : !!codeBlocks;
|
||||
const listItemEmptyLines = !!params.config.list_item_empty_lines;
|
||||
const strict = !!params.config.strict;
|
||||
const codeBlockLineNumbers = new Set();
|
||||
for (const codeBlock of filterByTypesCached([ "codeFenced" ])) {
|
||||
addRangeToSet(codeBlockLineNumbers, codeBlock.startLine + 1, codeBlock.endLine - 1);
|
||||
}
|
||||
for (const codeBlock of filterByTypesCached([ "codeIndented" ])) {
|
||||
addRangeToSet(codeBlockLineNumbers, codeBlock.startLine, codeBlock.endLine);
|
||||
if (!includeCode) {
|
||||
for (const codeBlock of filterByTypesCached([ "codeFenced" ])) {
|
||||
addRangeToSet(codeBlockLineNumbers, codeBlock.startLine + 1, codeBlock.endLine - 1);
|
||||
}
|
||||
for (const codeBlock of filterByTypesCached([ "codeIndented" ])) {
|
||||
addRangeToSet(codeBlockLineNumbers, codeBlock.startLine, codeBlock.endLine);
|
||||
}
|
||||
}
|
||||
const listItemLineNumbers = new Set();
|
||||
if (listItemEmptyLines) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue