Add images to blacklist for maximum-line-length

This commit is contained in:
Titus Wormer 2015-06-13 12:26:41 +02:00
parent 3f6344c730
commit ba6d270772
5 changed files with 18 additions and 10 deletions

View File

@ -598,7 +598,7 @@ Options: `boolean`, default: `false`.
Options: `number`, default: `80`.
Ignores nodes which cannot be wrapped, such as heasings, tables,
code, and links.
code, link, and images.
### 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, and links.
* code, link, and images.
* @example
* <!-- Valid, when set to `40` -->
* Alpha bravo charlie delta echo.
@ -113,8 +113,7 @@ function maximumLineLength(ast, file, preferred, done) {
* theres white-space after it, they are not
* whitelisted.
*/
visit(ast, 'link', function (node, pos, parent) {
function validateLink(node, pos, parent) {
var next = parent.children[pos + 1];
var initial = start(node);
var final = end(node);
@ -150,7 +149,10 @@ function maximumLineLength(ast, file, preferred, done) {
}
whitelist(initial.line - 1, final.line);
});
}
visit(ast, 'link', validateLink);
visit(ast, 'image', validateLink);
/*
* Iterate over every line, and warn for

View File

@ -2302,7 +2302,7 @@ module.exports = maximumHeadingLength;
* Options: `number`, default: `80`.
*
* Ignores nodes which cannot be wrapped, such as heasings, tables,
* code, and links.
* code, link, and images.
* @example
* <!-- Valid, when set to `40` -->
* Alpha bravo charlie delta echo.
@ -2407,8 +2407,7 @@ function maximumLineLength(ast, file, preferred, done) {
* theres white-space after it, they are not
* whitelisted.
*/
visit(ast, 'link', function (node, pos, parent) {
function validateLink(node, pos, parent) {
var next = parent.children[pos + 1];
var initial = start(node);
var final = end(node);
@ -2444,7 +2443,10 @@ function maximumLineLength(ast, file, preferred, done) {
}
whitelist(initial.line - 1, final.line);
});
}
visit(ast, 'link', validateLink);
visit(ast, 'image', validateLink);
/*
* Iterate over every line, and warn for

2
mdast-lint.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -5,8 +5,12 @@ This is also fine: <http://this-long-url-with-a-long-domain.co.uk/a-long-path?qu
<http://this-link-is-fine.com>
[foo](http://this-long-url-with-a-long-domain-is-valid.co.uk/a-long-path?query=variables)
<http://this-long-url-with-a-long-domain-is-valid.co.uk/a-long-path?query=variables>
![foo](http://this-long-url-with-a-long-domain-is-valid.co.uk/a-long-path?query=variables)
| An | exception | is | line | length | in | long | tables | because | those | cant | just |
| -- | --------- | -- | ---- | ------ | -- | ---- | ------ | ------- | ----- | ----- | ---- |
| be | helped | | | | | | | | | | . |