mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02:00
Add maximum parameter to MD012/no-multiple-blanks (fixes #27).
This commit is contained in:
parent
ce9ec8fb5e
commit
affd94e061
6 changed files with 86 additions and 5 deletions
|
@ -358,13 +358,13 @@ module.exports = [
|
|||
"tags": [ "whitespace", "blank_lines" ],
|
||||
"aliases": [ "no-multiple-blanks" ],
|
||||
"func": function MD012(params, errors) {
|
||||
var prevLine = "-";
|
||||
var maximum = params.options.maximum || 1;
|
||||
var count = 0;
|
||||
forEachLine(params, function forLine(line, lineIndex, inCode) {
|
||||
line = line.trim();
|
||||
if (!inCode && !line.length && !prevLine.length) {
|
||||
count = (inCode || line.trim().length) ? 0 : count + 1;
|
||||
if (maximum < count) {
|
||||
errors.push(lineIndex + 1);
|
||||
}
|
||||
prevLine = line;
|
||||
});
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue