Skip to content

Commit

Permalink
Remove maximum-line-length warnings on definitions
Browse files Browse the repository at this point in the history
Closes GH-21.
  • Loading branch information
wooorm committed Aug 5, 2015
1 parent 7de8847 commit 1119ca8
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion doc/rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 5 additions & 4 deletions lib/rules/maximum-line-length.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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';
}

/**
Expand Down Expand Up @@ -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;

Expand Down
9 changes: 5 additions & 4 deletions mdast-lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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';
}

/**
Expand Down Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion mdast-lint.min.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions test/fixtures/maximum-line-length-valid.md
Original file line number Diff line number Diff line change
Expand Up @@ -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>

0 comments on commit 1119ca8

Please sign in to comment.