mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02:00
Add MD013 with tests.
This commit is contained in:
parent
5d641bbf24
commit
434c7f388c
4 changed files with 30 additions and 0 deletions
14
lib/rules.js
14
lib/rules.js
|
@ -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
3
test/long_lines.md
Normal 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
6
test/long_lines_100.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"default": true,
|
||||
"MD013": {
|
||||
"line_length": 100
|
||||
}
|
||||
}
|
7
test/long_lines_100.md
Normal file
7
test/long_lines_100.md
Normal 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.
|
Loading…
Add table
Add a link
Reference in a new issue