mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 14:30:12 +01:00
Enhance MD022/blanks-around-headings with lines_above/lines_below parameters (fixes #143).
This commit is contained in:
parent
debc08bca1
commit
fa04d29485
24 changed files with 278 additions and 24 deletions
|
|
@ -4,7 +4,7 @@
|
|||
"ruleNames": [ "MD022", "blanks-around-headings", "blanks-around-headers" ],
|
||||
"ruleDescription": "Headings should be surrounded by blank lines",
|
||||
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022",
|
||||
"errorDetail": null,
|
||||
"errorDetail": "Expected: 1; Actual: 0; Below",
|
||||
"errorContext": "# Heading",
|
||||
"errorRange": null
|
||||
},
|
||||
|
|
|
|||
9
test/detailed-results-blanks-around-headings-0-2.json
Normal file
9
test/detailed-results-blanks-around-headings-0-2.json
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"default": true,
|
||||
"MD003": false,
|
||||
"MD012": false,
|
||||
"MD022": {
|
||||
"lines_above": 0,
|
||||
"lines_below": 2
|
||||
}
|
||||
}
|
||||
24
test/detailed-results-blanks-around-headings-0-2.md
Normal file
24
test/detailed-results-blanks-around-headings-0-2.md
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
# Blanks Around Headings
|
||||
|
||||
|
||||
## Apple
|
||||
|
||||
|
||||
Text
|
||||
## Banana
|
||||
|
||||
Text
|
||||
## Cherry
|
||||
|
||||
|
||||
Text
|
||||
## Durian ##
|
||||
|
||||
|
||||
Text
|
||||
|
||||
---
|
||||
Elderberry
|
||||
----------
|
||||
Text
|
||||
## Fig
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
[
|
||||
{
|
||||
"lineNumber": 8,
|
||||
"ruleNames": [ "MD022", "blanks-around-headings", "blanks-around-headers" ],
|
||||
"ruleDescription": "Headings should be surrounded by blank lines",
|
||||
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022",
|
||||
"errorDetail": "Expected: 2; Actual: 1; Below",
|
||||
"errorContext": "## Banana",
|
||||
"errorRange": null
|
||||
},
|
||||
{
|
||||
"lineNumber": 21,
|
||||
"ruleNames": [ "MD022", "blanks-around-headings", "blanks-around-headers" ],
|
||||
"ruleDescription": "Headings should be surrounded by blank lines",
|
||||
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022",
|
||||
"errorDetail": "Expected: 2; Actual: 0; Below",
|
||||
"errorContext": "Elderberry",
|
||||
"errorRange": null
|
||||
}
|
||||
]
|
||||
9
test/detailed-results-blanks-around-headings-3-0.json
Normal file
9
test/detailed-results-blanks-around-headings-3-0.json
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"default": true,
|
||||
"MD003": false,
|
||||
"MD012": false,
|
||||
"MD022": {
|
||||
"lines_above": 3,
|
||||
"lines_below": 0
|
||||
}
|
||||
}
|
||||
28
test/detailed-results-blanks-around-headings-3-0.md
Normal file
28
test/detailed-results-blanks-around-headings-3-0.md
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
# Blanks Around Headings
|
||||
|
||||
|
||||
|
||||
## Apple
|
||||
Text
|
||||
|
||||
|
||||
|
||||
## Banana
|
||||
Text
|
||||
|
||||
|
||||
|
||||
## Cherry
|
||||
Text
|
||||
|
||||
|
||||
## Durian ##
|
||||
Text
|
||||
|
||||
Elderberry
|
||||
----------
|
||||
Text
|
||||
|
||||
|
||||
|
||||
## Fig
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
[
|
||||
{
|
||||
"lineNumber": 19,
|
||||
"ruleNames": [ "MD022", "blanks-around-headings", "blanks-around-headers" ],
|
||||
"ruleDescription": "Headings should be surrounded by blank lines",
|
||||
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022",
|
||||
"errorDetail": "Expected: 3; Actual: 2; Above",
|
||||
"errorContext": "## Durian ##",
|
||||
"errorRange": null
|
||||
},
|
||||
{
|
||||
"lineNumber": 22,
|
||||
"ruleNames": [ "MD022", "blanks-around-headings", "blanks-around-headers" ],
|
||||
"ruleDescription": "Headings should be surrounded by blank lines",
|
||||
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022",
|
||||
"errorDetail": "Expected: 3; Actual: 1; Above",
|
||||
"errorContext": "Elderberry",
|
||||
"errorRange": null
|
||||
}
|
||||
]
|
||||
4
test/detailed-results-blanks-around-headings.json
Normal file
4
test/detailed-results-blanks-around-headings.json
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"default": true,
|
||||
"MD003": false
|
||||
}
|
||||
22
test/detailed-results-blanks-around-headings.md
Normal file
22
test/detailed-results-blanks-around-headings.md
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
# Blanks Around Headings
|
||||
|
||||
## Apple
|
||||
|
||||
Text
|
||||
|
||||
## Banana
|
||||
Text
|
||||
|
||||
## Cherry
|
||||
|
||||
Text
|
||||
## Durian ##
|
||||
|
||||
Text
|
||||
|
||||
---
|
||||
Elderberry
|
||||
----------
|
||||
Text
|
||||
|
||||
## Fig
|
||||
29
test/detailed-results-blanks-around-headings.results.json
Normal file
29
test/detailed-results-blanks-around-headings.results.json
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
[
|
||||
{
|
||||
"lineNumber": 7,
|
||||
"ruleNames": [ "MD022", "blanks-around-headings", "blanks-around-headers" ],
|
||||
"ruleDescription": "Headings should be surrounded by blank lines",
|
||||
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022",
|
||||
"errorDetail": "Expected: 1; Actual: 0; Below",
|
||||
"errorContext": "## Banana",
|
||||
"errorRange": null
|
||||
},
|
||||
{
|
||||
"lineNumber": 13,
|
||||
"ruleNames": [ "MD022", "blanks-around-headings", "blanks-around-headers" ],
|
||||
"ruleDescription": "Headings should be surrounded by blank lines",
|
||||
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022",
|
||||
"errorDetail": "Expected: 1; Actual: 0; Above",
|
||||
"errorContext": "## Durian ##",
|
||||
"errorRange": null
|
||||
},
|
||||
{
|
||||
"lineNumber": 18,
|
||||
"ruleNames": [ "MD022", "blanks-around-headings", "blanks-around-headers" ],
|
||||
"ruleDescription": "Headings should be surrounded by blank lines",
|
||||
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022",
|
||||
"errorDetail": "Expected: 1; Actual: 0; Above",
|
||||
"errorContext": "Elderberry",
|
||||
"errorRange": null
|
||||
}
|
||||
]
|
||||
|
|
@ -1152,7 +1152,7 @@ module.exports.readme = function readme(test) {
|
|||
};
|
||||
|
||||
module.exports.doc = function doc(test) {
|
||||
test.expect(311);
|
||||
test.expect(312);
|
||||
fs.readFile("doc/Rules.md", shared.utf8Encoding,
|
||||
function readFile(err, contents) {
|
||||
test.ifError(err);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue