Add MD013 with tests.

This commit is contained in:
David Anson 2015-03-04 18:36:30 -08:00
parent 5d641bbf24
commit 434c7f388c
4 changed files with 30 additions and 0 deletions

View file

@ -232,6 +232,20 @@ module.exports = [
}
},
{
"name": "MD013",
"desc": "Line length",
"func": function MD013(params, errors) {
var lineLength = params.options.line_length || 80;
var regex = new RegExp("^.{" + lineLength + "}.*\\s");
params.lines.forEach(function forLine(line, lineIndex) {
if (regex.test(line)) {
errors.push(lineIndex + 1);
}
});
}
},
{
"name": "MD028",
"desc": "Blank line inside blockquote",

3
test/long_lines.md Normal file
View file

@ -0,0 +1,3 @@
This is a very very very very very very very very very very very very very very long line {MD013}
This line however, while very long, doesn't have whitespace after the 80th columnwhichallowsforURLsandotherlongthings.

6
test/long_lines_100.json Normal file
View file

@ -0,0 +1,6 @@
{
"default": true,
"MD013": {
"line_length": 100
}
}

7
test/long_lines_100.md Normal file
View file

@ -0,0 +1,7 @@
This is a very very very very very very very very long line over 80 chars but less than 100
This is a very very very very very very very very very very long line over 80 chars, and also over 100. {MD013}
This is a very very very very very very very very very long line that is exactly 100 characters long
This line however, while very long, doesn't have whitespace after the 100th columnwhichallowsforURLsandotherlongthings.