mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 14:00:13 +01:00
Update MD022/blanks-around-headings to allow passing -1 for lines_above/lines_below to allow any number of blank lines in that direction (fixes #546).
This commit is contained in:
parent
f079df140c
commit
809841098d
12 changed files with 273 additions and 58 deletions
33
test/blanks-around-headings--1-1.md
Normal file
33
test/blanks-around-headings--1-1.md
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
# Blanks Around Headings
|
||||
|
||||
## Apple
|
||||
|
||||
Text
|
||||
## Banana
|
||||
|
||||
Text
|
||||
|
||||
## Cherry
|
||||
|
||||
Text
|
||||
|
||||
|
||||
## Durian ##
|
||||
|
||||
Text
|
||||
|
||||
Elderberry {MD022}
|
||||
------------------
|
||||
Text
|
||||
|
||||
---
|
||||
## Fig
|
||||
|
||||
<!-- markdownlint-configure-file {
|
||||
"heading-style": false,
|
||||
"no-multiple-blanks": false,
|
||||
"blanks-around-headings": {
|
||||
"lines_above": -1,
|
||||
"lines_below": 1
|
||||
}
|
||||
} -->
|
||||
35
test/blanks-around-headings-1--1.md
Normal file
35
test/blanks-around-headings-1--1.md
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
# Blanks Around Headings
|
||||
|
||||
## Apple
|
||||
Text
|
||||
|
||||
## Banana
|
||||
|
||||
Text
|
||||
|
||||
## Cherry
|
||||
|
||||
|
||||
Text
|
||||
|
||||
---
|
||||
## Durian {MD022} ##
|
||||
|
||||
Text
|
||||
|
||||
---
|
||||
|
||||
Elderberry
|
||||
------------------
|
||||
Text
|
||||
|
||||
## Fig
|
||||
|
||||
<!-- markdownlint-configure-file {
|
||||
"heading-style": false,
|
||||
"no-multiple-blanks": false,
|
||||
"blanks-around-headings": {
|
||||
"lines_above": 1,
|
||||
"lines_below": -1
|
||||
}
|
||||
} -->
|
||||
|
|
@ -919,7 +919,7 @@ test("readme", (t) => new Promise((resolve) => {
|
|||
}));
|
||||
|
||||
test("validateJsonUsingConfigSchemaStrict", (t) => {
|
||||
t.plan(156);
|
||||
t.plan(158);
|
||||
const configRe =
|
||||
/^[\s\S]*<!-- markdownlint-configure-file ([\s\S]*) -->[\s\S]*$/;
|
||||
const ignoreFiles = new Set([
|
||||
|
|
|
|||
|
|
@ -4173,6 +4173,68 @@ Generated by [AVA](https://avajs.dev).
|
|||
`,
|
||||
}
|
||||
|
||||
## blanks-around-headings--1-1.md
|
||||
|
||||
> Snapshot 1
|
||||
|
||||
{
|
||||
errors: [
|
||||
{
|
||||
errorContext: 'Elderberry {MD022}',
|
||||
errorDetail: 'Expected: 1; Actual: 0; Below',
|
||||
errorRange: null,
|
||||
fixInfo: {
|
||||
insertText: `␊
|
||||
`,
|
||||
lineNumber: 21,
|
||||
},
|
||||
lineNumber: 19,
|
||||
ruleDescription: 'Headings should be surrounded by blank lines',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md022.md',
|
||||
ruleNames: [
|
||||
'MD022',
|
||||
'blanks-around-headings',
|
||||
'blanks-around-headers',
|
||||
],
|
||||
},
|
||||
],
|
||||
fixed: `# Blanks Around Headings␊
|
||||
␊
|
||||
## Apple␊
|
||||
␊
|
||||
Text␊
|
||||
## Banana␊
|
||||
␊
|
||||
Text␊
|
||||
␊
|
||||
## Cherry␊
|
||||
␊
|
||||
Text␊
|
||||
␊
|
||||
␊
|
||||
## Durian ##␊
|
||||
␊
|
||||
Text␊
|
||||
␊
|
||||
Elderberry {MD022}␊
|
||||
------------------␊
|
||||
␊
|
||||
Text␊
|
||||
␊
|
||||
---␊
|
||||
## Fig␊
|
||||
␊
|
||||
<!-- markdownlint-configure-file {␊
|
||||
"heading-style": false,␊
|
||||
"no-multiple-blanks": false,␊
|
||||
"blanks-around-headings": {␊
|
||||
"lines_above": -1,␊
|
||||
"lines_below": 1␊
|
||||
}␊
|
||||
} -->␊
|
||||
`,
|
||||
}
|
||||
|
||||
## blanks-around-headings-0-2.md
|
||||
|
||||
> Snapshot 1
|
||||
|
|
@ -4256,6 +4318,69 @@ Generated by [AVA](https://avajs.dev).
|
|||
`,
|
||||
}
|
||||
|
||||
## blanks-around-headings-1--1.md
|
||||
|
||||
> Snapshot 1
|
||||
|
||||
{
|
||||
errors: [
|
||||
{
|
||||
errorContext: '## Durian {MD022} ##',
|
||||
errorDetail: 'Expected: 1; Actual: 0; Above',
|
||||
errorRange: null,
|
||||
fixInfo: {
|
||||
insertText: `␊
|
||||
`,
|
||||
},
|
||||
lineNumber: 16,
|
||||
ruleDescription: 'Headings should be surrounded by blank lines',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md022.md',
|
||||
ruleNames: [
|
||||
'MD022',
|
||||
'blanks-around-headings',
|
||||
'blanks-around-headers',
|
||||
],
|
||||
},
|
||||
],
|
||||
fixed: `# Blanks Around Headings␊
|
||||
␊
|
||||
## Apple␊
|
||||
Text␊
|
||||
␊
|
||||
## Banana␊
|
||||
␊
|
||||
Text␊
|
||||
␊
|
||||
## Cherry␊
|
||||
␊
|
||||
␊
|
||||
Text␊
|
||||
␊
|
||||
---␊
|
||||
␊
|
||||
## Durian {MD022} ##␊
|
||||
␊
|
||||
Text␊
|
||||
␊
|
||||
---␊
|
||||
␊
|
||||
Elderberry␊
|
||||
------------------␊
|
||||
Text␊
|
||||
␊
|
||||
## Fig␊
|
||||
␊
|
||||
<!-- markdownlint-configure-file {␊
|
||||
"heading-style": false,␊
|
||||
"no-multiple-blanks": false,␊
|
||||
"blanks-around-headings": {␊
|
||||
"lines_above": 1,␊
|
||||
"lines_below": -1␊
|
||||
}␊
|
||||
} -->␊
|
||||
`,
|
||||
}
|
||||
|
||||
## blanks-around-headings-3-0.md
|
||||
|
||||
> Snapshot 1
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue