remark-lint-maximum-heading-length
Advanced tools
Comparing version 1.0.3 to 1.0.4
14
index.js
@@ -13,3 +13,3 @@ /** | ||
* | ||
* @example {"name": "valid.md"} | ||
* @example {"name": "ok.md"} | ||
* | ||
@@ -20,7 +20,7 @@ * # Alpha bravo charlie delta echo foxtrot golf hotel | ||
* | ||
* @example {"name": "invalid.md", "setting": 40, "label": "input"} | ||
* @example {"name": "not-ok.md", "setting": 40, "label": "input"} | ||
* | ||
* # Alpha bravo charlie delta echo foxtrot golf hotel | ||
* | ||
* @example {"name": "invalid.md", "setting": 40, "label": "output"} | ||
* @example {"name": "not-ok.md", "setting": 40, "label": "output"} | ||
* | ||
@@ -42,4 +42,4 @@ * 1:1-1:52: Use headings shorter than `40` | ||
function maximumHeadingLength(tree, file, pref) { | ||
pref = typeof pref === 'number' && !isNaN(pref) ? pref : 60 | ||
function maximumHeadingLength(tree, file, option) { | ||
var preferred = typeof option === 'number' && !isNaN(option) ? option : 60 | ||
@@ -49,6 +49,6 @@ visit(tree, 'heading', visitor) | ||
function visitor(node) { | ||
if (!generated(node) && toString(node).length > pref) { | ||
file.message('Use headings shorter than `' + pref + '`', node) | ||
if (!generated(node) && toString(node).length > preferred) { | ||
file.message('Use headings shorter than `' + preferred + '`', node) | ||
} | ||
} | ||
} |
{ | ||
"name": "remark-lint-maximum-heading-length", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "remark-lint rule to warn when headings are too long", | ||
@@ -10,2 +10,3 @@ "license": "MIT", | ||
"rule", | ||
"remark-lint-rule", | ||
"heading", | ||
@@ -16,2 +17,6 @@ "length" | ||
"bugs": "https://github.com/remarkjs/remark-lint/issues", | ||
"funding": { | ||
"type": "opencollective", | ||
"url": "https://opencollective.com/unified" | ||
}, | ||
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", | ||
@@ -18,0 +23,0 @@ "contributors": [ |
@@ -29,3 +29,3 @@ <!--This file is generated--> | ||
##### `invalid.md` | ||
##### `not-ok.md` | ||
@@ -46,3 +46,3 @@ When configured with `40`. | ||
##### `valid.md` | ||
##### `ok.md` | ||
@@ -74,12 +74,12 @@ ###### In | ||
```diff | ||
... | ||
… | ||
"remarkConfig": { | ||
"plugins": [ | ||
... | ||
… | ||
"lint", | ||
+ "lint-maximum-heading-length", | ||
... | ||
… | ||
] | ||
} | ||
... | ||
… | ||
``` | ||
@@ -96,4 +96,4 @@ | ||
```diff | ||
var remark = require('remark'); | ||
var report = require('vfile-reporter'); | ||
var remark = require('remark') | ||
var report = require('vfile-reporter') | ||
@@ -104,4 +104,4 @@ remark() | ||
.process('_Emphasis_ and **importance**', function (err, file) { | ||
console.error(report(err || file)); | ||
}); | ||
console.error(report(err || file)) | ||
}) | ||
``` | ||
@@ -115,4 +115,4 @@ | ||
This project has a [Code of Conduct][coc]. | ||
By interacting with this repository, organisation, or community you agree to | ||
This project has a [code of conduct][coc]. | ||
By interacting with this repository, organization, or community you agree to | ||
abide by its terms. | ||
@@ -146,3 +146,3 @@ | ||
[chat-badge]: https://img.shields.io/badge/join%20the%20community-on%20spectrum-7b16ff.svg | ||
[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg | ||
@@ -149,0 +149,0 @@ [chat]: https://spectrum.chat/unified/remark |
5785