remark-lint
Advanced tools
Comparing version 3.0.0 to 3.1.0
@@ -5,2 +5,8 @@ <!--remark setext--> | ||
3.1.0 / 2016-04-03 | ||
================== | ||
* Update main heading rules to accept preferred depth ([`7f4a51e`](https://github.com/wooorm/remark-lint/commit/7f4a51e)) | ||
* Remove `:` requirement for `no-emphasis-as-heading` ([`d54441e`](https://github.com/wooorm/remark-lint/commit/d54441e)) | ||
3.0.0 / 2016-02-14 | ||
@@ -7,0 +13,0 @@ ================== |
@@ -7,5 +7,7 @@ /** | ||
* @fileoverview | ||
* Warn when the first heading has a level other than `1`. | ||
* Warn when the first heading has a level other than a specified value. | ||
* | ||
* Options: `number`, default: `1`. | ||
* @example | ||
* <!-- Valid: --> | ||
* <!-- Valid, when set to `1` --> | ||
* # Foo | ||
@@ -15,3 +17,3 @@ * | ||
* | ||
* <!-- Invalid: --> | ||
* <!-- Invalid, when set to `1` --> | ||
* ## Foo | ||
@@ -34,10 +36,12 @@ * | ||
/** | ||
* Warn when the first heading has a level other than `1`. | ||
* Warn when the first heading has a level other than a specified value. | ||
* | ||
* @param {Node} ast - Root node. | ||
* @param {File} file - Virtual file. | ||
* @param {*} preferred - Ignored. | ||
* @param {number?} [preferred=1] - First heading level. | ||
* @param {Function} done - Callback. | ||
*/ | ||
function firstHeadingLevel(ast, file, preferred, done) { | ||
var style = preferred && preferred !== true ? preferred : 1; | ||
visit(ast, 'heading', function (node) { | ||
@@ -48,4 +52,4 @@ if (position.generated(node)) { | ||
if (node.depth !== 1) { | ||
file.warn('First heading level should be `1`', node); | ||
if (node.depth !== style) { | ||
file.warn('First heading level should be `' + style + '`', node); | ||
} | ||
@@ -52,0 +56,0 @@ |
@@ -9,8 +9,5 @@ /** | ||
* a paragraph. | ||
* | ||
* Currently, only warns when a colon (`:`) is also included, maybe that | ||
* could be omitted. | ||
* @example | ||
* <!-- Valid: --> | ||
* # Foo: | ||
* # Foo | ||
* | ||
@@ -20,3 +17,3 @@ * Bar. | ||
* <!-- Invalid: --> | ||
* *Foo:* | ||
* *Foo* | ||
* | ||
@@ -35,3 +32,2 @@ * Bar. | ||
var visit = require('unist-util-visit'); | ||
var toString = require('mdast-util-to-string'); | ||
var position = require('mdast-util-position'); | ||
@@ -54,3 +50,2 @@ | ||
var next = parent.children[index + 1]; | ||
var value; | ||
@@ -68,12 +63,3 @@ if (position.generated(node)) { | ||
) { | ||
value = toString(child); | ||
/* | ||
* TODO: See if removing the punctuation | ||
* necessity is possible? | ||
*/ | ||
if (value.charAt(value.length - 1) === ':') { | ||
file.warn('Don’t use emphasis to introduce a section, use a heading', node); | ||
} | ||
file.warn('Don’t use emphasis to introduce a section, use a heading', node); | ||
} | ||
@@ -80,0 +66,0 @@ }); |
@@ -8,4 +8,6 @@ /** | ||
* Warn when multiple top-level headings are used. | ||
* | ||
* Options: `number`, default: `1`. | ||
* @example | ||
* <!-- Invalid: --> | ||
* <!-- Invalid, when set to `1` --> | ||
* # Foo | ||
@@ -15,3 +17,3 @@ * | ||
* | ||
* <!-- Valid: --> | ||
* <!-- Valid, when set to `1` --> | ||
* # Foo | ||
@@ -38,6 +40,7 @@ * | ||
* @param {File} file - Virtual file. | ||
* @param {*} preferred - Ignored. | ||
* @param {number?} [preferred=1] - Top heading level. | ||
* @param {Function} done - Callback. | ||
*/ | ||
function noMultipleToplevelHeadings(ast, file, preferred, done) { | ||
var style = preferred && preferred !== true ? preferred : 1; | ||
var topLevelheading = false; | ||
@@ -52,3 +55,3 @@ | ||
if (node.depth === 1) { | ||
if (node.depth === style) { | ||
if (topLevelheading) { | ||
@@ -55,0 +58,0 @@ pos = position.start(node); |
{ | ||
"name": "remark-lint", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"description": "Lint markdown with remark", | ||
@@ -28,3 +28,3 @@ "license": "MIT", | ||
"plur": "^2.0.0", | ||
"remark-message-control": "^1.0.1", | ||
"remark-message-control": "^2.0.0", | ||
"unist-util-visit": "^1.0.0", | ||
@@ -46,7 +46,7 @@ "vfile-location": "^2.0.0", | ||
"jscs-jsdoc": "^1.0.0", | ||
"remark": "^4.0.0-alpha.4", | ||
"remark": "^4.0.0", | ||
"remark-comment-config": "^3.0.0", | ||
"remark-github": "^4.0.1", | ||
"remark-toc": "^3.0.0", | ||
"remark-validate-links": "^2.0.0", | ||
"remark-validate-links": "^3.0.0", | ||
"mocha": "^2.0.0", | ||
@@ -53,0 +53,0 @@ "vfile": "^1.0.0" |
@@ -10,3 +10,3 @@ # ![remark-lint][logo] | ||
sure less refactoring is needed afterwards. What is quality? That’s up to you, | ||
but the defaults are sensible :ok\_hand:. | ||
but the defaults are sensible :ok_hand:. | ||
@@ -13,0 +13,0 @@ **remark-lint** has lots of tests. Supports Node, io.js, and the browser. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
142137
4657
+ Addedremark-message-control@2.0.3(transitive)
+ Addedtrim@0.0.1(transitive)
- Removedremark-message-control@1.0.1(transitive)
- Removedremark-range@2.0.0(transitive)