Remove maximum-line-length warnings on definitions

Closes GH-21.
This commit is contained in:
Titus Wormer 2015-08-05 10:06:42 +02:00
parent 7de8847b55
commit 1119ca83b7
5 changed files with 16 additions and 10 deletions

View File

@ -661,7 +661,7 @@ Options: `boolean`, default: `false`.
Options: `number`, default: `80`.
Ignores nodes which cannot be wrapped, such as heasings, tables,
code, link, and images.
code, link, images, and definitions.
### no-auto-link-without-protocol

View File

@ -8,7 +8,7 @@
* Options: `number`, default: `80`.
*
* Ignores nodes which cannot be wrapped, such as heasings, tables,
* code, link, and images.
* code, link, images, and definitions.
* @example
* <!-- Valid, when set to `40` -->
* Alpha bravo charlie delta echo.
@ -53,10 +53,11 @@ var end = position.end;
* @return {boolean} - Whether or not `node` should be
* ignored.
*/
function isApplicable(node) {
function isIgnored(node) {
return node.type === 'heading' ||
node.type === 'table' ||
node.type === 'code';
node.type === 'code' ||
node.type === 'definition';
}
/**
@ -96,7 +97,7 @@ function maximumLineLength(ast, file, preferred, done) {
*/
visit(ast, function (node) {
var applicable = isApplicable(node);
var applicable = isIgnored(node);
var initial = applicable && start(node).line;
var final = applicable && end(node).line;

View File

@ -2654,7 +2654,7 @@ module.exports = maximumHeadingLength;
* Options: `number`, default: `80`.
*
* Ignores nodes which cannot be wrapped, such as heasings, tables,
* code, link, and images.
* code, link, images, and definitions.
* @example
* <!-- Valid, when set to `40` -->
* Alpha bravo charlie delta echo.
@ -2699,10 +2699,11 @@ var end = position.end;
* @return {boolean} - Whether or not `node` should be
* ignored.
*/
function isApplicable(node) {
function isIgnored(node) {
return node.type === 'heading' ||
node.type === 'table' ||
node.type === 'code';
node.type === 'code' ||
node.type === 'definition';
}
/**
@ -2742,7 +2743,7 @@ function maximumLineLength(ast, file, preferred, done) {
*/
visit(ast, function (node) {
var applicable = isApplicable(node);
var applicable = isIgnored(node);
var initial = applicable && start(node).line;
var final = applicable && end(node).line;

2
mdast-lint.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -18,3 +18,7 @@ This is also fine: <http://this-long-url-with-a-long-domain.co.uk/a-long-path?qu
The following is also fine, because there is no white-space.
<http://this-long-url-with-a-long-domain-is-invalid.co.uk/a-long-path?query=variables>.
In addition, definitions are also fine:
[foo]: <http://this-long-url-with-a-long-domain-is-invalid.co.uk/a-long-path?query=variables>