Enhance MD022/blanks-around-headings with lines_above/lines_below parameters (fixes #143).

This commit is contained in:
David Anson 2019-03-24 21:50:56 -07:00
parent debc08bca1
commit fa04d29485
24 changed files with 278 additions and 24 deletions

View file

@ -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
},

View file

@ -0,0 +1,9 @@
{
"default": true,
"MD003": false,
"MD012": false,
"MD022": {
"lines_above": 0,
"lines_below": 2
}
}

View file

@ -0,0 +1,24 @@
# Blanks Around Headings
## Apple
Text
## Banana
Text
## Cherry
Text
## Durian ##
Text
---
Elderberry
----------
Text
## Fig

View file

@ -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
}
]

View file

@ -0,0 +1,9 @@
{
"default": true,
"MD003": false,
"MD012": false,
"MD022": {
"lines_above": 3,
"lines_below": 0
}
}

View file

@ -0,0 +1,28 @@
# Blanks Around Headings
## Apple
Text
## Banana
Text
## Cherry
Text
## Durian ##
Text
Elderberry
----------
Text
## Fig

View file

@ -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
}
]

View file

@ -0,0 +1,4 @@
{
"default": true,
"MD003": false
}

View file

@ -0,0 +1,22 @@
# Blanks Around Headings
## Apple
Text
## Banana
Text
## Cherry
Text
## Durian ##
Text
---
Elderberry
----------
Text
## Fig

View 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
}
]

View file

@ -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);