Replace dox w/ comment-parser

This commit is contained in:
Titus Wormer 2021-08-11 16:41:00 +02:00
parent 4a832b145e
commit 5c398a8213
No known key found for this signature in database
GPG Key ID: E6E581152ED04E2E
70 changed files with 667 additions and 369 deletions

View File

@ -34,7 +34,7 @@
"type": "module",
"devDependencies": {
"c8": "^7.0.0",
"dox": "^0.9.0",
"comment-parser": "^1.0.0",
"lerna": "^4.0.0",
"mdast-zone": "^5.0.0",
"parse-author": "^2.0.0",

View File

@ -11,15 +11,16 @@
* `'consistent'` detects the first used indentation and will warn when
* other block quotes use a different indentation.
*
* @example {"name": "ok.md", "setting": 4}
* @example
* {"name": "ok.md", "setting": 4}
*
* > Hello
*
* Paragraph.
*
* > World
*
* @example {"name": "ok.md", "setting": 2}
* @example
* {"name": "ok.md", "setting": 2}
*
* > Hello
*
@ -27,7 +28,8 @@
*
* > World
*
* @example {"name": "not-ok.md", "label": "input"}
* @example
* {"name": "not-ok.md", "label": "input"}
*
* > Hello
*
@ -39,7 +41,8 @@
*
* > World
*
* @example {"name": "not-ok.md", "label": "output"}
* @example
* {"name": "not-ok.md", "label": "output"}
*
* 5:5: Remove 1 space between block quote and content
* 9:3: Add 1 space between block quote and content

View File

@ -26,45 +26,53 @@
* See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown)
* on how to automatically fix warnings for this rule.
*
* @example {"name": "ok.md", "setting": {"checked": "x"}, "gfm": true}
* @example
* {"name": "ok.md", "setting": {"checked": "x"}, "gfm": true}
*
* - [x] List item
* - [x] List item
*
* @example {"name": "ok.md", "setting": {"checked": "X"}, "gfm": true}
* @example
* {"name": "ok.md", "setting": {"checked": "X"}, "gfm": true}
*
* - [X] List item
* - [X] List item
*
* @example {"name": "ok.md", "setting": {"unchecked": " "}, "gfm": true}
* @example
* {"name": "ok.md", "setting": {"unchecked": " "}, "gfm": true}
*
* - [ ] List item
* - [ ] List item
* - [ ]··
* - [ ]
*
* @example {"name": "ok.md", "setting": {"unchecked": "\t"}, "gfm": true}
* @example
* {"name": "ok.md", "setting": {"unchecked": "\t"}, "gfm": true}
*
* - [»] List item
* - [»] List item
*
* @example {"name": "not-ok.md", "label": "input", "gfm": true}
* @example
* {"name": "not-ok.md", "label": "input", "gfm": true}
*
* - [x] List item
* - [X] List item
* - [ ] List item
* - [»] List item
*
* @example {"name": "not-ok.md", "label": "output", "gfm": true}
* @example
* {"name": "not-ok.md", "label": "output", "gfm": true}
*
* 2:5: Checked checkboxes should use `x` as a marker
* 4:5: Unchecked checkboxes should use ` ` as a marker
*
* @example {"setting": {"unchecked": "💩"}, "name": "not-ok.md", "label": "output", "positionless": true, "gfm": true}
* @example
* {"setting": {"unchecked": "💩"}, "name": "not-ok.md", "label": "output", "positionless": true, "gfm": true}
*
* 1:1: Incorrect unchecked checkbox marker `💩`: use either `'\t'`, or `' '`
*
* @example {"setting": {"checked": "💩"}, "name": "not-ok.md", "label": "output", "positionless": true, "gfm": true}
* @example
* {"setting": {"checked": "💩"}, "name": "not-ok.md", "label": "output", "positionless": true, "gfm": true}
*
* 1:1: Incorrect checked checkbox marker `💩`: use either `'x'`, or `'X'`
*/

View File

@ -6,21 +6,24 @@
* @fileoverview
* Warn when list item checkboxes are followed by too much whitespace.
*
* @example {"name": "ok.md", "gfm": true}
* @example
* {"name": "ok.md", "gfm": true}
*
* - [ ] List item
* + [x] List Item
* * [X] List item
* - [ ] List item
*
* @example {"name": "not-ok.md", "label": "input", "gfm": true}
* @example
* {"name": "not-ok.md", "label": "input", "gfm": true}
*
* - [ ] List item
* + [x] List item
* * [X] List item
* - [ ] List item
*
* @example {"name": "not-ok.md", "label": "output", "gfm": true}
* @example
* {"name": "not-ok.md", "label": "output", "gfm": true}
*
* 2:7-2:8: Checkboxes should be followed by a single character
* 3:7-3:9: Checkboxes should be followed by a single character

View File

@ -23,7 +23,8 @@
* See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown)
* on how to automatically fix warnings for this rule.
*
* @example {"setting": "indented", "name": "ok.md"}
* @example
* {"setting": "indented", "name": "ok.md"}
*
* alpha()
*
@ -31,7 +32,8 @@
*
* bravo()
*
* @example {"setting": "indented", "name": "not-ok.md", "label": "input"}
* @example
* {"setting": "indented", "name": "not-ok.md", "label": "input"}
*
* ```
* alpha()
@ -43,12 +45,14 @@
* bravo()
* ```
*
* @example {"setting": "indented", "name": "not-ok.md", "label": "output"}
* @example
* {"setting": "indented", "name": "not-ok.md", "label": "output"}
*
* 1:1-3:4: Code blocks should be indented
* 7:1-9:4: Code blocks should be indented
*
* @example {"setting": "fenced", "name": "ok.md"}
* @example
* {"setting": "fenced", "name": "ok.md"}
*
* ```
* alpha()
@ -60,7 +64,8 @@
* bravo()
* ```
*
* @example {"setting": "fenced", "name": "not-ok-fenced.md", "label": "input"}
* @example
* {"setting": "fenced", "name": "not-ok-fenced.md", "label": "input"}
*
* alpha()
*
@ -68,12 +73,14 @@
*
* bravo()
*
* @example {"setting": "fenced", "name": "not-ok-fenced.md", "label": "output"}
* @example
* {"setting": "fenced", "name": "not-ok-fenced.md", "label": "output"}
*
* 1:1-1:12: Code blocks should be fenced
* 5:1-5:12: Code blocks should be fenced
*
* @example {"name": "not-ok-consistent.md", "label": "input"}
* @example
* {"name": "not-ok-consistent.md", "label": "input"}
*
* alpha()
*
@ -83,11 +90,13 @@
* bravo()
* ```
*
* @example {"name": "not-ok-consistent.md", "label": "output"}
* @example
* {"name": "not-ok-consistent.md", "label": "output"}
*
* 5:1-7:4: Code blocks should be indented
*
* @example {"setting": "💩", "name": "not-ok-incorrect.md", "label": "output", "positionless": true}
* @example
* {"setting": "💩", "name": "not-ok-incorrect.md", "label": "output", "positionless": true}
*
* 1:1: Incorrect code block style `💩`: use either `'consistent'`, `'fenced'`, or `'indented'`
*/

View File

@ -6,15 +6,18 @@
* @fileoverview
* Warn when definition labels are not lowercase.
*
* @example {"name": "ok.md"}
* @example
* {"name": "ok.md"}
*
* [example]: http://example.com "Example Domain"
*
* @example {"name": "not-ok.md", "label": "input"}
* @example
* {"name": "not-ok.md", "label": "input"}
*
* [Example]: http://example.com "Example Domain"
*
* @example {"name": "not-ok.md", "label": "output"}
* @example
* {"name": "not-ok.md", "label": "output"}
*
* 1:1-1:47: Do not use uppercase characters in definition labels
*/

View File

@ -6,15 +6,18 @@
* @fileoverview
* Warn when consecutive whitespace is used in a definition.
*
* @example {"name": "ok.md"}
* @example
* {"name": "ok.md"}
*
* [example domain]: http://example.com "Example Domain"
*
* @example {"name": "not-ok.md", "label": "input"}
* @example
* {"name": "not-ok.md", "label": "input"}
*
* [example····domain]: http://example.com "Example Domain"
*
* @example {"name": "not-ok.md", "label": "output"}
* @example
* {"name": "not-ok.md", "label": "output"}
*
* 1:1-1:57: Do not use consecutive whitespace in definition labels
*/

View File

@ -22,40 +22,49 @@
* See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown)
* on how to automatically fix warnings for this rule.
*
* @example {"setting": "*", "name": "ok.md"}
* @example
* {"setting": "*", "name": "ok.md"}
*
* *foo*
*
* @example {"setting": "*", "name": "not-ok.md", "label": "input"}
* @example
* {"setting": "*", "name": "not-ok.md", "label": "input"}
*
* _foo_
*
* @example {"setting": "*", "name": "not-ok.md", "label": "output"}
* @example
* {"setting": "*", "name": "not-ok.md", "label": "output"}
*
* 1:1-1:6: Emphasis should use `*` as a marker
*
* @example {"setting": "_", "name": "ok.md"}
* @example
* {"setting": "_", "name": "ok.md"}
*
* _foo_
*
* @example {"setting": "_", "name": "not-ok.md", "label": "input"}
* @example
* {"setting": "_", "name": "not-ok.md", "label": "input"}
*
* *foo*
*
* @example {"setting": "_", "name": "not-ok.md", "label": "output"}
* @example
* {"setting": "_", "name": "not-ok.md", "label": "output"}
*
* 1:1-1:6: Emphasis should use `_` as a marker
*
* @example {"name": "not-ok.md", "label": "input"}
* @example
* {"name": "not-ok.md", "label": "input"}
*
* *foo*
* _bar_
*
* @example {"name": "not-ok.md", "label": "output"}
* @example
* {"name": "not-ok.md", "label": "output"}
*
* 2:1-2:6: Emphasis should use `*` as a marker
*
* @example {"setting": "💩", "name": "not-ok.md", "label": "output", "positionless": true}
* @example
* {"setting": "💩", "name": "not-ok.md", "label": "output", "positionless": true}
*
* 1:1: Incorrect emphasis marker `💩`: use either `'consistent'`, `'*'`, or `'_'`
*/

View File

@ -15,51 +15,60 @@
* An `allowEmpty` field (`boolean`, default: `false`) can be set to allow
* code blocks without language flags.
*
* @example {"name": "ok.md"}
* @example
* {"name": "ok.md"}
*
* ```alpha
* bravo()
* ```
*
* @example {"name": "not-ok.md", "label": "input"}
* @example
* {"name": "not-ok.md", "label": "input"}
*
* ```
* alpha()
* ```
*
* @example {"name": "not-ok.md", "label": "output"}
* @example
* {"name": "not-ok.md", "label": "output"}
*
* 1:1-3:4: Missing code language flag
*
* @example {"name": "ok.md", "setting": {"allowEmpty": true}}
* @example
* {"name": "ok.md", "setting": {"allowEmpty": true}}
*
* ```
* alpha()
* ```
*
* @example {"name": "not-ok.md", "setting": {"allowEmpty": false}, "label": "input"}
* @example
* {"name": "not-ok.md", "setting": {"allowEmpty": false}, "label": "input"}
*
* ```
* alpha()
* ```
*
* @example {"name": "not-ok.md", "setting": {"allowEmpty": false}, "label": "output"}
* @example
* {"name": "not-ok.md", "setting": {"allowEmpty": false}, "label": "output"}
*
* 1:1-3:4: Missing code language flag
*
* @example {"name": "ok.md", "setting": ["alpha"]}
* @example
* {"name": "ok.md", "setting": ["alpha"]}
*
* ```alpha
* bravo()
* ```
*
* @example {"name": "not-ok.md", "setting": ["charlie"], "label": "input"}
* @example
* {"name": "not-ok.md", "setting": ["charlie"], "label": "input"}
*
* ```alpha
* bravo()
* ```
*
* @example {"name": "not-ok.md", "setting": ["charlie"], "label": "output"}
* @example
* {"name": "not-ok.md", "setting": ["charlie"], "label": "output"}
*
* 1:1-3:4: Incorrect code language flag
*/

View File

@ -22,13 +22,15 @@
* See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown)
* on how to automatically fix warnings for this rule.
*
* @example {"name": "ok.md"}
* @example
* {"name": "ok.md"}
*
* Indented code blocks are not affected by this rule:
*
* bravo()
*
* @example {"name": "ok.md", "setting": "`"}
* @example
* {"name": "ok.md", "setting": "`"}
*
* ```alpha
* bravo()
@ -38,7 +40,8 @@
* charlie()
* ```
*
* @example {"name": "ok.md", "setting": "~"}
* @example
* {"name": "ok.md", "setting": "~"}
*
* ~~~alpha
* bravo()
@ -48,7 +51,8 @@
* charlie()
* ~~~
*
* @example {"name": "not-ok-consistent-tick.md", "label": "input"}
* @example
* {"name": "not-ok-consistent-tick.md", "label": "input"}
*
* ```alpha
* bravo()
@ -58,11 +62,13 @@
* charlie()
* ~~~
*
* @example {"name": "not-ok-consistent-tick.md", "label": "output"}
* @example
* {"name": "not-ok-consistent-tick.md", "label": "output"}
*
* 5:1-7:4: Fenced code should use `` ` `` as a marker
*
* @example {"name": "not-ok-consistent-tilde.md", "label": "input"}
* @example
* {"name": "not-ok-consistent-tilde.md", "label": "input"}
*
* ~~~alpha
* bravo()
@ -72,11 +78,13 @@
* charlie()
* ```
*
* @example {"name": "not-ok-consistent-tilde.md", "label": "output"}
* @example
* {"name": "not-ok-consistent-tilde.md", "label": "output"}
*
* 5:1-7:4: Fenced code should use `~` as a marker
*
* @example {"name": "not-ok-incorrect.md", "setting": "💩", "label": "output", "positionless": true}
* @example
* {"name": "not-ok-incorrect.md", "setting": "💩", "label": "output", "positionless": true}
*
* 1:1: Incorrect fenced code marker `💩`: use either `'consistent'`, `` '`' ``, or `'~'`
*/

View File

@ -11,15 +11,19 @@
*
* Options: `string`, default: `'md'` Expected file extension.
*
* @example {"name": "readme.md"}
* @example
* {"name": "readme.md"}
*
* @example {"name": "readme"}
* @example
* {"name": "readme"}
*
* @example {"name": "readme.mkd", "label": "output", "positionless": true}
* @example
* {"name": "readme.mkd", "label": "output", "positionless": true}
*
* 1:1: Incorrect extension: use `md`
*
* @example {"name": "readme.mkd", "setting": "mkd"}
* @example
* {"name": "readme.mkd", "setting": "mkd"}
*/
import {lintRule} from 'unified-lint-rule'

View File

@ -7,13 +7,15 @@
* Warn when definitions are placed somewhere other than at the end of
* the file.
*
* @example {"name": "ok.md"}
* @example
* {"name": "ok.md"}
*
* Paragraph.
*
* [example]: http://example.com "Example Domain"
*
* @example {"name": "not-ok.md", "label": "input"}
* @example
* {"name": "not-ok.md", "label": "input"}
*
* Paragraph.
*
@ -21,11 +23,13 @@
*
* Another paragraph.
*
* @example {"name": "not-ok.md", "label": "output"}
* @example
* {"name": "not-ok.md", "label": "output"}
*
* 3:1-3:47: Move definitions to the end of the file (after the node at line `5`)
*
* @example {"name": "ok-comments.md"}
* @example
* {"name": "ok-comments.md"}
*
* Paragraph.
*

View File

@ -8,15 +8,18 @@
*
* Options: `number`, default: `1`.
*
* @example {"name": "ok.md"}
* @example
* {"name": "ok.md"}
*
* # The default is to expect a level one heading
*
* @example {"name": "ok-html.md"}
* @example
* {"name": "ok-html.md"}
*
* <h1>An HTML heading is also seen by this rule.</h1>
*
* @example {"name": "ok-delayed.md"}
* @example
* {"name": "ok-delayed.md"}
*
* You can use markdown content before the heading.
*
@ -24,55 +27,65 @@
*
* <h1>So the first heading, be it HTML or markdown, is checked</h1>
*
* @example {"name": "not-ok.md", "label": "input"}
* @example
* {"name": "not-ok.md", "label": "input"}
*
* ## Bravo
*
* Paragraph.
*
* @example {"name": "not-ok.md", "label": "output"}
* @example
* {"name": "not-ok.md", "label": "output"}
*
* 1:1-1:9: First heading level should be `1`
*
* @example {"name": "not-ok-html.md", "label": "input"}
* @example
* {"name": "not-ok-html.md", "label": "input"}
*
* <h2>Charlie</h2>
*
* Paragraph.
*
* @example {"name": "not-ok-html.md", "label": "output"}
* @example
* {"name": "not-ok-html.md", "label": "output"}
*
* 1:1-1:17: First heading level should be `1`
*
* @example {"name": "ok.md", "setting": 2}
* @example
* {"name": "ok.md", "setting": 2}
*
* ## Delta
*
* Paragraph.
*
* @example {"name": "ok-html.md", "setting": 2}
* @example
* {"name": "ok-html.md", "setting": 2}
*
* <h2>Echo</h2>
*
* Paragraph.
*
* @example {"name": "not-ok.md", "setting": 2, "label": "input"}
* @example
* {"name": "not-ok.md", "setting": 2, "label": "input"}
*
* # Foxtrot
*
* Paragraph.
*
* @example {"name": "not-ok.md", "setting": 2, "label": "output"}
* @example
* {"name": "not-ok.md", "setting": 2, "label": "output"}
*
* 1:1-1:10: First heading level should be `2`
*
* @example {"name": "not-ok-html.md", "setting": 2, "label": "input"}
* @example
* {"name": "not-ok-html.md", "setting": 2, "label": "input"}
*
* <h1>Golf</h1>
*
* Paragraph.
*
* @example {"name": "not-ok-html.md", "setting": 2, "label": "output"}
* @example
* {"name": "not-ok-html.md", "setting": 2, "label": "output"}
*
* 1:1-1:14: First heading level should be `2`
*/

View File

@ -6,17 +6,20 @@
* @fileoverview
* Warn when too many spaces are used to create a hard break.
*
* @example {"name": "ok.md"}
* @example
* {"name": "ok.md"}
*
* Lorem ipsum··
* dolor sit amet
*
* @example {"name": "not-ok.md", "label": "input"}
* @example
* {"name": "not-ok.md", "label": "input"}
*
* Lorem ipsum···
* dolor sit amet.
*
* @example {"name": "not-ok.md", "label": "output"}
* @example
* {"name": "not-ok.md", "label": "output"}
*
* 1:12-2:1: Use two spaces for hard line breaks
*/

View File

@ -6,19 +6,22 @@
* @fileoverview
* Warn when headings increment with more than 1 level at a time.
*
* @example {"name": "ok.md"}
* @example
* {"name": "ok.md"}
*
* # Alpha
*
* ## Bravo
*
* @example {"name": "not-ok.md", "label": "input"}
* @example
* {"name": "not-ok.md", "label": "input"}
*
* # Charlie
*
* ### Delta
*
* @example {"name": "not-ok.md", "label": "output"}
* @example
* {"name": "not-ok.md", "label": "output"}
*
* 3:1-3:10: Heading levels should increment by one level at a time
*/

View File

@ -25,7 +25,8 @@
* See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown)
* on how to automatically fix warnings for this rule.
*
* @example {"name": "ok.md", "setting": "atx"}
* @example
* {"name": "ok.md", "setting": "atx"}
*
* # Alpha
*
@ -33,7 +34,8 @@
*
* ### Charlie
*
* @example {"name": "ok.md", "setting": "atx-closed"}
* @example
* {"name": "ok.md", "setting": "atx-closed"}
*
* # Delta ##
*
@ -41,7 +43,8 @@
*
* ### Foxtrot ###
*
* @example {"name": "ok.md", "setting": "setext"}
* @example
* {"name": "ok.md", "setting": "setext"}
*
* Golf
* ====
@ -51,7 +54,8 @@
*
* ### India
*
* @example {"name": "not-ok.md", "label": "input"}
* @example
* {"name": "not-ok.md", "label": "input"}
*
* Juliett
* =======
@ -60,7 +64,8 @@
*
* ### Lima ###
*
* @example {"name": "not-ok.md", "label": "output"}
* @example
* {"name": "not-ok.md", "label": "output"}
*
* 4:1-4:8: Headings should use setext
* 6:1-6:13: Headings should use setext

View File

@ -18,29 +18,35 @@
* See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown)
* on how to automatically fix warnings for this rule.
*
* @example {"name": "ok-consistent-as-windows.md"}
* @example
* {"name": "ok-consistent-as-windows.md"}
*
* Alpha
* Bravo
*
* @example {"name": "ok-consistent-as-unix.md"}
* @example
* {"name": "ok-consistent-as-unix.md"}
*
* Alpha
* Bravo
*
* @example {"name": "not-ok-unix.md", "label": "input", "setting": "unix", "positionless": true}
* @example
* {"name": "not-ok-unix.md", "label": "input", "setting": "unix", "positionless": true}
*
* Alpha
*
* @example {"name": "not-ok-unix.md", "label": "output", "setting": "unix"}
* @example
* {"name": "not-ok-unix.md", "label": "output", "setting": "unix"}
*
* 1:7: Expected linebreaks to be unix (`\n`), not windows (`\r\n`)
*
* @example {"name": "not-ok-windows.md", "label": "input", "setting": "windows", "positionless": true}
* @example
* {"name": "not-ok-windows.md", "label": "input", "setting": "windows", "positionless": true}
*
* Alpha
*
* @example {"name": "not-ok-windows.md", "label": "output", "setting": "windows"}
* @example
* {"name": "not-ok-windows.md", "label": "output", "setting": "windows"}
*
* 1:6: Expected linebreaks to be windows (`\r\n`), not unix (`\n`)
*/

View File

@ -20,7 +20,8 @@
* See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown)
* on how to automatically fix warnings for this rule.
*
* @example {"name": "ok.md", "setting": "\""}
* @example
* {"name": "ok.md", "setting": "\""}
*
* [Example](http://example.com#without-title)
* [Example](http://example.com "Example Domain")
@ -32,15 +33,18 @@
*
* [Example](#Heading-(optional))
*
* @example {"name": "not-ok.md", "label": "input", "setting": "\""}
* @example
* {"name": "not-ok.md", "label": "input", "setting": "\""}
*
* [Example]: http://example.com 'Example Domain'
*
* @example {"name": "not-ok.md", "label": "output", "setting": "\""}
* @example
* {"name": "not-ok.md", "label": "output", "setting": "\""}
*
* 1:31-1:47: Titles should use `"` as a quote
*
* @example {"name": "ok.md", "setting": "'"}
* @example
* {"name": "ok.md", "setting": "'"}
*
* [Example](http://example.com#without-title)
* [Example](http://example.com 'Example Domain')
@ -48,15 +52,18 @@
*
* [Example]: http://example.com 'Example Domain'
*
* @example {"name": "not-ok.md", "label": "input", "setting": "'"}
* @example
* {"name": "not-ok.md", "label": "input", "setting": "'"}
*
* [Example]: http://example.com "Example Domain"
*
* @example {"name": "not-ok.md", "label": "output", "setting": "'"}
* @example
* {"name": "not-ok.md", "label": "output", "setting": "'"}
*
* 1:31-1:47: Titles should use `'` as a quote
*
* @example {"name": "ok.md", "setting": "()"}
* @example
* {"name": "ok.md", "setting": "()"}
*
* [Example](http://example.com#without-title)
* [Example](http://example.com (Example Domain))
@ -64,24 +71,29 @@
*
* [Example]: http://example.com (Example Domain)
*
* @example {"name": "not-ok.md", "label": "input", "setting": "()"}
* @example
* {"name": "not-ok.md", "label": "input", "setting": "()"}
*
* [Example](http://example.com 'Example Domain')
*
* @example {"name": "not-ok.md", "label": "output", "setting": "()"}
* @example
* {"name": "not-ok.md", "label": "output", "setting": "()"}
*
* 1:30-1:46: Titles should use `()` as a quote
*
* @example {"name": "not-ok.md", "label": "input"}
* @example
* {"name": "not-ok.md", "label": "input"}
*
* [Example](http://example.com "Example Domain")
* [Example](http://example.com 'Example Domain')
*
* @example {"name": "not-ok.md", "label": "output"}
* @example
* {"name": "not-ok.md", "label": "output"}
*
* 2:30-2:46: Titles should use `"` as a quote
*
* @example {"name": "not-ok.md", "setting": "💩", "label": "output", "positionless": true}
* @example
* {"name": "not-ok.md", "setting": "💩", "label": "output", "positionless": true}
*
* 1:1: Incorrect link title style marker `💩`: use either `'consistent'`, `'"'`, `'\''`, or `'()'`
*/

View File

@ -14,21 +14,24 @@
* See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown)
* on how to automatically fix warnings for this rule.
*
* @example {"name": "ok.md"}
* @example
* {"name": "ok.md"}
*
* Paragraph.
*
* * List item
* * List item
*
* @example {"name": "not-ok.md", "label": "input"}
* @example
* {"name": "not-ok.md", "label": "input"}
*
* Paragraph.
*
* ·* List item
* ·* List item
*
* @example {"name": "not-ok.md", "label": "output"}
* @example
* {"name": "not-ok.md", "label": "output"}
*
* 3:2: Incorrect indentation before bullet: remove 1 space
* 4:2: Incorrect indentation before bullet: remove 1 space

View File

@ -6,17 +6,20 @@
* @fileoverview
* Warn when the content of a list item has mixed indentation.
*
* @example {"name": "ok.md", "gfm": true}
* @example
* {"name": "ok.md", "gfm": true}
*
* 1.·[x] Alpha
* ···1. Bravo
*
* @example {"name": "not-ok.md", "label": "input", "gfm": true}
* @example
* {"name": "not-ok.md", "label": "input", "gfm": true}
*
* 1.·[x] Charlie
* ····1. Delta
*
* @example {"name": "not-ok.md", "label": "output", "gfm": true}
* @example
* {"name": "not-ok.md", "label": "output", "gfm": true}
*
* 2:5: Dont use mixed indentation for children, remove 1 space
*/

View File

@ -22,7 +22,8 @@
* See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown)
* on how to automatically fix warnings for this rule.
*
* @example {"name": "ok.md"}
* @example
* {"name": "ok.md"}
*
* *···List
* ····item.
@ -40,7 +41,8 @@
* *···List
* ····item.
*
* @example {"name": "ok.md", "setting": "mixed"}
* @example
* {"name": "ok.md", "setting": "mixed"}
*
* *·List item.
*
@ -56,7 +58,8 @@
* *···List
* ····item.
*
* @example {"name": "ok.md", "setting": "space"}
* @example
* {"name": "ok.md", "setting": "space"}
*
* *·List item.
*
@ -72,33 +75,40 @@
* *·List
* ··item.
*
* @example {"name": "not-ok.md", "setting": "space", "label": "input"}
* @example
* {"name": "not-ok.md", "setting": "space", "label": "input"}
*
* *···List
* ····item.
*
* @example {"name": "not-ok.md", "setting": "space", "label": "output"}
* @example
* {"name": "not-ok.md", "setting": "space", "label": "output"}
*
* 1:5: Incorrect list-item indent: remove 2 spaces
*
* @example {"name": "not-ok.md", "setting": "tab-size", "label": "input"}
* @example
* {"name": "not-ok.md", "setting": "tab-size", "label": "input"}
*
* *·List
* ··item.
*
* @example {"name": "not-ok.md", "setting": "tab-size", "label": "output"}
* @example
* {"name": "not-ok.md", "setting": "tab-size", "label": "output"}
*
* 1:3: Incorrect list-item indent: add 2 spaces
*
* @example {"name": "not-ok.md", "setting": "mixed", "label": "input"}
* @example
* {"name": "not-ok.md", "setting": "mixed", "label": "input"}
*
* *···List item.
*
* @example {"name": "not-ok.md", "setting": "mixed", "label": "output"}
* @example
* {"name": "not-ok.md", "setting": "mixed", "label": "output"}
*
* 1:5: Incorrect list-item indent: remove 2 spaces
*
* @example {"name": "not-ok.md", "setting": "💩", "label": "output", "positionless": true}
* @example
* {"name": "not-ok.md", "setting": "💩", "label": "output", "positionless": true}
*
* 1:1: Incorrect list-item indent style `💩`: use either `'tab-size'`, `'space'`, or `'mixed'`
*/

View File

@ -20,7 +20,8 @@
* more items contain blank lines.
* Otherwise, the list must be tight.
*
* @example {"name": "ok.md"}
* @example
* {"name": "ok.md"}
*
* A tight list:
*
@ -37,7 +38,8 @@
*
* - item 3
*
* @example {"name": "not-ok.md", "label": "input"}
* @example
* {"name": "not-ok.md", "label": "input"}
*
* A tight list:
*
@ -54,14 +56,16 @@
*
* - item 3
*
* @example {"name": "not-ok.md", "label": "output"}
* @example
* {"name": "not-ok.md", "label": "output"}
*
* 4:9-5:1: Missing new line after list item
* 5:11-6:1: Missing new line after list item
* 10:11-12:1: Extraneous new line after list item
* 12:11-14:1: Extraneous new line after list item
*
* @example {"name": "ok.md", "setting": {"checkBlanks": true}}
* @example
* {"name": "ok.md", "setting": {"checkBlanks": true}}
*
* A tight list:
*
@ -80,7 +84,8 @@
*
* > Block quote
*
* @example {"name": "not-ok.md", "setting": {"checkBlanks": true}, "label": "input"}
* @example
* {"name": "not-ok.md", "setting": {"checkBlanks": true}, "label": "input"}
*
* A tight list:
*
@ -100,7 +105,8 @@
* - item 2
* > Block quote
*
* @example {"name": "not-ok.md", "setting": {"checkBlanks": true}, "label": "output"}
* @example
* {"name": "not-ok.md", "setting": {"checkBlanks": true}, "label": "output"}
*
* 5:15-6:1: Missing new line after list item
* 8:18-9:1: Missing new line after list item

View File

@ -10,17 +10,20 @@
*
* Ignores Markdown syntax, only checks the plain text content.
*
* @example {"name": "ok.md"}
* @example
* {"name": "ok.md"}
*
* # Alpha bravo charlie delta echo foxtrot golf hotel
*
* # ![Alpha bravo charlie delta echo foxtrot golf hotel](http://example.com/nato.png)
*
* @example {"name": "not-ok.md", "setting": 40, "label": "input"}
* @example
* {"name": "not-ok.md", "setting": 40, "label": "input"}
*
* # Alpha bravo charlie delta echo foxtrot golf hotel
*
* @example {"name": "not-ok.md", "setting": 40, "label": "output"}
* @example
* {"name": "not-ok.md", "setting": 40, "label": "output"}
*
* 1:1-1:52: Use headings shorter than `40`
*/

View File

@ -14,7 +14,8 @@
* Ignores images, links, and inline code if they start before the wrap, end
* after the wrap, and theres no whitespace after them.
*
* @example {"name": "ok.md", "positionless": true, "gfm": true}
* @example
* {"name": "ok.md", "positionless": true, "gfm": true}
*
* This line is simply not toooooooooooooooooooooooooooooooooooooooooooo
* long.
@ -45,7 +46,8 @@
*
* [foo]: <http://this-long-url-with-a-long-domain-is-ok.co.uk/a-long-path?query=variables>
*
* @example {"name": "not-ok.md", "setting": 80, "label": "input", "positionless": true}
* @example
* {"name": "not-ok.md", "setting": 80, "label": "input", "positionless": true}
*
* This line is simply not tooooooooooooooooooooooooooooooooooooooooooooooooooooooo
* long.
@ -60,7 +62,8 @@
*
* `alphaBravoCharlieDeltaEchoFoxtrotGolfHotelIndiaJuliettKiloLimaMikeNovemberOscar.papa()` and such.
*
* @example {"name": "not-ok.md", "setting": 80, "label": "output", "positionless": true}
* @example
* {"name": "not-ok.md", "setting": 80, "label": "output", "positionless": true}
*
* 4:86: Line must be at most 80 characters
* 6:99: Line must be at most 80 characters
@ -68,21 +71,24 @@
* 10:97: Line must be at most 80 characters
* 12:99: Line must be at most 80 characters
*
* @example {"name": "ok-mixed-line-endings.md", "setting": 10, "positionless": true}
* @example
* {"name": "ok-mixed-line-endings.md", "setting": 10, "positionless": true}
*
* 0123456789
* 0123456789
* 01234
* 01234
*
* @example {"name": "not-ok-mixed-line-endings.md", "setting": 10, "label": "input", "positionless": true}
* @example
* {"name": "not-ok-mixed-line-endings.md", "setting": 10, "label": "input", "positionless": true}
*
* 012345678901
* 012345678901
* 01234567890
* 01234567890
*
* @example {"name": "not-ok-mixed-line-endings.md", "setting": 10, "label": "output", "positionless": true}
* @example
* {"name": "not-ok-mixed-line-endings.md", "setting": 10, "label": "output", "positionless": true}
*
* 1:13: Line must be at most 10 characters
* 2:13: Line must be at most 10 characters

View File

@ -16,7 +16,8 @@
* See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown)
* on how to automatically fix warnings for this rule.
*
* @example {"name": "ok.md"}
* @example
* {"name": "ok.md"}
*
* <http://www.example.com>
* <mailto:foo@bar.com>
@ -24,11 +25,13 @@
* Most Markdown vendors dont recognize the following as a link:
* <www.example.com>
*
* @example {"name": "not-ok.md", "label": "input"}
* @example
* {"name": "not-ok.md", "label": "input"}
*
* <foo@bar.com>
*
* @example {"name": "not-ok.md", "label": "output"}
* @example
* {"name": "not-ok.md", "label": "output"}
*
* 1:1-1:14: All automatic links must start with a protocol
*/

View File

@ -15,35 +15,41 @@
* See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown)
* on how to automatically fix warnings for this rule.
*
* @example {"name": "ok.md"}
* @example
* {"name": "ok.md"}
*
* > Foo
* > bar
* > baz.
*
* @example {"name": "ok-tabs.md"}
* @example
* {"name": "ok-tabs.md"}
*
* >»Foo
* >»bar
* >»baz.
*
* @example {"name": "not-ok.md", "label": "input"}
* @example
* {"name": "not-ok.md", "label": "input"}
*
* > Foo
* bar
* > baz.
*
* @example {"name": "not-ok.md", "label": "output"}
* @example
* {"name": "not-ok.md", "label": "output"}
*
* 2:1: Missing marker in block quote
*
* @example {"name": "not-ok-tabs.md", "label": "input"}
* @example
* {"name": "not-ok-tabs.md", "label": "input"}
*
* >»Foo
* »bar
* baz.
*
* @example {"name": "not-ok-tabs.md", "label": "output"}
* @example
* {"name": "not-ok-tabs.md", "label": "output"}
*
* 2:1: Missing marker in block quote
* 3:1: Missing marker in block quote

View File

@ -17,15 +17,18 @@
* See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown)
* on how to automatically fix warnings for this rule.
*
* @example {"name": "ok.md"}
* @example
* {"name": "ok.md"}
*
* Foo
*
* Bar.
*
* @example {"name": "empty-document.md"}
* @example
* {"name": "empty-document.md"}
*
* @example {"name": "not-ok.md", "label": "input"}
* @example
* {"name": "not-ok.md", "label": "input"}
*
* Foo
*
@ -34,7 +37,8 @@
*
*
*
* @example {"name": "not-ok.md", "label": "output"}
* @example
* {"name": "not-ok.md", "label": "output"}
*
* 4:1: Remove 1 line before node
* 4:5: Remove 2 lines after node

View File

@ -6,17 +6,20 @@
* @fileoverview
* Warn when definitions define the same URL.
*
* @example {"name": "ok.md"}
* @example
* {"name": "ok.md"}
*
* [alpha]: alpha.com
* [bravo]: bravo.com
*
* @example {"name": "not-ok.md", "label": "input"}
* @example
* {"name": "not-ok.md", "label": "input"}
*
* [alpha]: alpha.com
* [bravo]: alpha.com
*
* @example {"name": "not-ok.md", "label": "output"}
* @example
* {"name": "not-ok.md", "label": "output"}
*
* 2:1-2:19: Do not use different definitions with the same URL (1:1)
*/

View File

@ -6,17 +6,20 @@
* @fileoverview
* Warn when duplicate definitions are found.
*
* @example {"name": "ok.md"}
* @example
* {"name": "ok.md"}
*
* [foo]: bar
* [baz]: qux
*
* @example {"name": "not-ok.md", "label": "input"}
* @example
* {"name": "not-ok.md", "label": "input"}
*
* [foo]: bar
* [foo]: qux
*
* @example {"name": "not-ok.md", "label": "output"}
* @example
* {"name": "not-ok.md", "label": "output"}
*
* 2:1-2:11: Do not use definitions with the same identifier (1:1)
*/

View File

@ -7,7 +7,8 @@
* Warn when duplicate headings are found, but only when on the same level,
* in the same section.
*
* @example {"name": "ok.md"}
* @example
* {"name": "ok.md"}
*
* ## Alpha
*
@ -25,7 +26,8 @@
*
* ##### Bravo
*
* @example {"name": "not-ok.md", "label": "input"}
* @example
* {"name": "not-ok.md", "label": "input"}
*
* ## Foxtrot
*
@ -33,11 +35,13 @@
*
* ### Golf
*
* @example {"name": "not-ok.md", "label": "output"}
* @example
* {"name": "not-ok.md", "label": "output"}
*
* 5:1-5:9: Do not use headings with similar content per section (3:1)
*
* @example {"name": "not-ok-tolerant-heading-increment.md", "label": "input"}
* @example
* {"name": "not-ok-tolerant-heading-increment.md", "label": "input"}
*
* # Alpha
*
@ -49,7 +53,8 @@
*
* ###### Delta
*
* @example {"name": "not-ok-tolerant-heading-increment.md", "label": "output"}
* @example
* {"name": "not-ok-tolerant-heading-increment.md", "label": "output"}
*
* 7:1-7:11: Do not use headings with similar content per section (3:1)
*/

View File

@ -6,13 +6,15 @@
* @fileoverview
* Warn when duplicate headings are found.
*
* @example {"name": "ok.md"}
* @example
* {"name": "ok.md"}
*
* # Foo
*
* ## Bar
*
* @example {"name": "not-ok.md", "label": "input"}
* @example
* {"name": "not-ok.md", "label": "input"}
*
* # Foo
*
@ -20,7 +22,8 @@
*
* ## [Foo](http://foo.com/bar)
*
* @example {"name": "not-ok.md", "label": "output"}
* @example
* {"name": "not-ok.md", "label": "output"}
*
* 3:1-3:7: Do not use headings with similar content (1:1)
* 5:1-5:29: Do not use headings with similar content (3:1)

View File

@ -7,13 +7,15 @@
* Warn when emphasis (including strong), instead of a heading, introduces
* a paragraph.
*
* @example {"name": "ok.md"}
* @example
* {"name": "ok.md"}
*
* # Foo
*
* Bar.
*
* @example {"name": "not-ok.md", "label": "input"}
* @example
* {"name": "not-ok.md", "label": "input"}
*
* *Foo*
*
@ -23,7 +25,8 @@
*
* Quux.
*
* @example {"name": "not-ok.md", "label": "output"}
* @example
* {"name": "not-ok.md", "label": "output"}
*
* 1:1-1:6: Dont use emphasis to introduce a section, use a heading
* 5:1-5:8: Dont use emphasis to introduce a section, use a heading

View File

@ -6,19 +6,22 @@
* @fileoverview
* Warn for empty URLs in links and images.
*
* @example {"name": "ok.md"}
* @example
* {"name": "ok.md"}
*
* [alpha](http://bravo.com).
*
* ![charlie](http://delta.com/echo.png "foxtrot").
*
* @example {"name": "not-ok.md", "label": "input"}
* @example
* {"name": "not-ok.md", "label": "input"}
*
* [golf]().
*
* ![hotel]().
*
* @example {"name": "not-ok.md", "label": "output"}
* @example
* {"name": "not-ok.md", "label": "output"}
*
* 1:1-1:9: Dont use links without URL
* 3:1-3:11: Dont use images without URL

View File

@ -6,21 +6,26 @@
* @fileoverview
* Warn when file names start with an article.
*
* @example {"name": "title.md"}
* @example
* {"name": "title.md"}
*
* @example {"name": "a-title.md", "label": "output", "positionless": true}
* @example
* {"name": "a-title.md", "label": "output", "positionless": true}
*
* 1:1: Do not start file names with `a`
*
* @example {"name": "the-title.md", "label": "output", "positionless": true}
* @example
* {"name": "the-title.md", "label": "output", "positionless": true}
*
* 1:1: Do not start file names with `the`
*
* @example {"name": "teh-title.md", "label": "output", "positionless": true}
* @example
* {"name": "teh-title.md", "label": "output", "positionless": true}
*
* 1:1: Do not start file names with `teh`
*
* @example {"name": "an-article.md", "label": "output", "positionless": true}
* @example
* {"name": "an-article.md", "label": "output", "positionless": true}
*
* 1:1: Do not start file names with `an`
*/

View File

@ -6,9 +6,11 @@
* @fileoverview
* Warn when file names contain consecutive dashes.
*
* @example {"name": "plug-ins.md"}
* @example
* {"name": "plug-ins.md"}
*
* @example {"name": "plug--ins.md", "label": "output", "positionless": true}
* @example
* {"name": "plug--ins.md", "label": "output", "positionless": true}
*
* 1:1: Do not use consecutive dashes in a file name
*/

View File

@ -15,19 +15,24 @@
*
* Any match by the wrapped or given expressions creates a message.
*
* @example {"name": "plug-ins.md"}
* @example
* {"name": "plug-ins.md"}
*
* @example {"name": "plugins.md"}
* @example
* {"name": "plugins.md"}
*
* @example {"name": "plug_ins.md", "label": "output", "positionless": true}
* @example
* {"name": "plug_ins.md", "label": "output", "positionless": true}
*
* 1:1: Do not use `_` in a file name
*
* @example {"name": "README.md", "label": "output", "setting": "\\.a-z0-9", "positionless": true}
* @example
* {"name": "README.md", "label": "output", "setting": "\\.a-z0-9", "positionless": true}
*
* 1:1: Do not use `R` in a file name
*
* @example {"name": "plug ins.md", "label": "output", "positionless": true}
* @example
* {"name": "plug ins.md", "label": "output", "positionless": true}
*
* 1:1: Do not use ` ` in a file name
*/

View File

@ -6,11 +6,14 @@
* @fileoverview
* Warn when file names use mixed case: both upper- and lowercase characters.
*
* @example {"name": "README.md"}
* @example
* {"name": "README.md"}
*
* @example {"name": "readme.md"}
* @example
* {"name": "readme.md"}
*
* @example {"name": "Readme.md", "label": "output", "positionless": true}
* @example
* {"name": "Readme.md", "label": "output", "positionless": true}
*
* 1:1: Do not mix casing in file names
*/

View File

@ -6,13 +6,16 @@
* @fileoverview
* Warn when file names contain initial or final dashes (hyphen-minus, `-`).
*
* @example {"name": "readme.md"}
* @example
* {"name": "readme.md"}
*
* @example {"name": "-readme.md", "label": "output", "positionless": true}
* @example
* {"name": "-readme.md", "label": "output", "positionless": true}
*
* 1:1: Do not use initial or final dashes in a file name
*
* @example {"name": "readme-.md", "label": "output", "positionless": true}
* @example
* {"name": "readme-.md", "label": "output", "positionless": true}
*
* 1:1: Do not use initial or final dashes in a file name
*/

View File

@ -14,7 +14,8 @@
* See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown)
* on how to automatically fix warnings for this rule.
*
* @example {"name": "ok.md"}
* @example
* {"name": "ok.md"}
*
* #·Foo
*
@ -27,7 +28,8 @@
* Baz
* ===
*
* @example {"name": "not-ok.md", "label": "input"}
* @example
* {"name": "not-ok.md", "label": "input"}
*
* #··Foo
*
@ -35,13 +37,15 @@
*
* ##··Baz
*
* @example {"name": "not-ok.md", "label": "output"}
* @example
* {"name": "not-ok.md", "label": "output"}
*
* 1:4: Remove 1 space before this headings content
* 3:7: Remove 1 space after this headings content
* 5:7: Remove 1 space before this headings content
*
* @example {"name": "empty-heading.md"}
* @example
* {"name": "empty-heading.md"}
*
* #··
*/

View File

@ -14,7 +14,8 @@
* See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown)
* on how to automatically fix warnings for this rule.
*
* @example {"name": "ok.md"}
* @example
* {"name": "ok.md"}
*
* #·Hello world
*
@ -26,7 +27,8 @@
* Bar
* =====
*
* @example {"name": "not-ok.md", "label": "input"}
* @example
* {"name": "not-ok.md", "label": "input"}
*
* ···# Hello world
*
@ -38,7 +40,8 @@
* ···Bar
* =====
*
* @example {"name": "not-ok.md", "label": "output"}
* @example
* {"name": "not-ok.md", "label": "output"}
*
* 1:4: Remove 3 spaces before this heading
* 3:2: Remove 1 space before this heading

View File

@ -6,19 +6,22 @@
* @fileoverview
* Warn for h7+ headings.
*
* @example {"name": "ok.md"}
* @example
* {"name": "ok.md"}
*
* ###### Alpha
*
* Bravo.
*
* @example {"name": "not-ok.md", "label": "input"}
* @example
* {"name": "not-ok.md", "label": "input"}
*
* ####### Charlie
*
* Delta.
*
* @example {"name": "not-ok.md", "label": "output"}
* @example
* {"name": "not-ok.md", "label": "output"}
*
* 1:1-1:16: This looks like a heading but has too many hashes
*/

View File

@ -11,15 +11,18 @@
* Note: these are added to a regex, in a group (`'[' + char + ']'`), be
* careful to escape the string correctly.
*
* @example {"name": "ok.md"}
* @example
* {"name": "ok.md"}
*
* # Hello
*
* @example {"name": "ok.md", "setting": ",;:!?"}
* @example
* {"name": "ok.md", "setting": ",;:!?"}
*
* # Hello
*
* @example {"name": "not-ok.md", "label": "input"}
* @example
* {"name": "not-ok.md", "label": "input"}
*
* # Hello:
*
@ -31,7 +34,8 @@
*
* # Hello;
*
* @example {"name": "not-ok.md", "label": "output"}
* @example
* {"name": "not-ok.md", "label": "output"}
*
* 1:1-1:9: Dont add a trailing `:` to headings
* 3:1-3:9: Dont add a trailing `?` to headings

View File

@ -9,17 +9,20 @@
* Ignores comments, because they are used by `remark`, `remark-lint`, other
* Markdown tools, and because Markdown doesnt have native comments.
*
* @example {"name": "ok.md"}
* @example
* {"name": "ok.md"}
*
* # Hello
*
* <!--Comments are also OK-->
*
* @example {"name": "not-ok.md", "label": "input"}
* @example
* {"name": "not-ok.md", "label": "input"}
*
* <h1>Hello</h1>
*
* @example {"name": "not-ok.md", "label": "output"}
* @example
* {"name": "not-ok.md", "label": "output"}
*
* 1:1-1:15: Do not use HTML in markdown
*/

View File

@ -9,15 +9,18 @@
*
* Warns for emphasis, strong, delete, image, and link.
*
* @example {"name": "ok.md"}
* @example
* {"name": "ok.md"}
*
* Alpha [bravo](http://echo.fox/trot)
*
* @example {"name": "not-ok.md", "label": "input"}
* @example
* {"name": "not-ok.md", "label": "input"}
*
* Alpha [ bravo ](http://echo.fox/trot)
*
* @example {"name": "not-ok.md", "label": "output"}
* @example
* {"name": "not-ok.md", "label": "output"}
*
* 1:7-1:38: Dont pad `link` with inner spaces
*/

View File

@ -18,15 +18,18 @@
* See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown)
* on how to automatically fix warnings for this rule.
*
* @example {"name": "ok.md"}
* @example
* {"name": "ok.md"}
*
* <http://foo.bar/baz>
*
* @example {"name": "not-ok.md", "label": "input", "gfm": true}
* @example
* {"name": "not-ok.md", "label": "input", "gfm": true}
*
* http://foo.bar/baz
*
* @example {"name": "not-ok.md", "label": "output", "gfm": true}
* @example
* {"name": "not-ok.md", "label": "output", "gfm": true}
*
* 1:1-1:19: Dont use literal URLs without angle brackets
*/

View File

@ -21,7 +21,8 @@
* See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown)
* on how to automatically fix warnings for this rule.
*
* @example {"name": "ok.md"}
* @example
* {"name": "ok.md"}
*
* # Foo
*
@ -33,7 +34,8 @@
*
* Paragraph.
*
* @example {"name": "not-ok.md", "label": "input"}
* @example
* {"name": "not-ok.md", "label": "input"}
*
* # Foo
* ## Bar
@ -43,12 +45,14 @@
*
* Paragraph.
*
* @example {"name": "not-ok.md", "label": "output"}
* @example
* {"name": "not-ok.md", "label": "output"}
*
* 2:1-2:7: Missing blank line before block node
* 5:3-5:10: Missing blank line before block node
*
* @example {"name": "tight.md", "setting": {"exceptTightLists": true}, "label": "input"}
* @example
* {"name": "tight.md", "setting": {"exceptTightLists": true}, "label": "input"}
*
* # Foo
* ## Bar
@ -58,7 +62,8 @@
*
* Paragraph.
*
* @example {"name": "tight.md", "setting": {"exceptTightLists": true}, "label": "output"}
* @example
* {"name": "tight.md", "setting": {"exceptTightLists": true}, "label": "output"}
*
* 2:1-2:7: Missing blank line before block node
*/

View File

@ -8,19 +8,22 @@
*
* Options: `number`, default: `1`.
*
* @example {"name": "ok.md", "setting": 1}
* @example
* {"name": "ok.md", "setting": 1}
*
* # Foo
*
* ## Bar
*
* @example {"name": "not-ok.md", "setting": 1, "label": "input"}
* @example
* {"name": "not-ok.md", "setting": 1, "label": "input"}
*
* # Foo
*
* # Bar
*
* @example {"name": "not-ok.md", "setting": 1, "label": "output"}
* @example
* {"name": "not-ok.md", "setting": 1, "label": "output"}
*
* 3:1-3:6: Dont use multiple top level headings (1:1)
*/

View File

@ -6,7 +6,8 @@
* @fileoverview
* Warn when the content in paragraphs is indented.
*
* @example {"name": "ok.md"}
* @example
* {"name": "ok.md"}
*
* Alpha
*
@ -34,7 +35,8 @@
*
* [![][text]][text]
*
* @example {"name": "not-ok.md", "label": "input"}
* @example
* {"name": "not-ok.md", "label": "input"}
*
* ·Alpha
*
@ -59,7 +61,8 @@
* oscar
* ·papa.
*
* @example {"name": "not-ok.md", "label": "output"}
* @example
* {"name": "not-ok.md", "label": "output"}
*
* 1:2: Expected no indentation in paragraph content
* 4:2: Expected no indentation in paragraph content

View File

@ -6,19 +6,22 @@
* @fileoverview
* Warn when URLs are also defined identifiers.
*
* @example {"name": "ok.md"}
* @example
* {"name": "ok.md"}
*
* [Alpha](http://example.com).
*
* [bravo]: https://example.com
*
* @example {"name": "not-ok.md", "label": "input"}
* @example
* {"name": "not-ok.md", "label": "input"}
*
* [Charlie](delta).
*
* [delta]: https://example.com
*
* @example {"name": "not-ok.md", "label": "output"}
* @example
* {"name": "not-ok.md", "label": "output"}
*
* 1:1-1:17: Did you mean to use `[delta]` instead of `(delta)`, a reference?
*/

View File

@ -8,7 +8,8 @@
*
* Ignores indented code blocks and fenced code blocks without language flag.
*
* @example {"name": "ok.md"}
* @example
* {"name": "ok.md"}
*
* ```bash
* echo a
@ -36,7 +37,8 @@
* $('div').remove()
* ```
*
* @example {"name": "not-ok.md", "label": "input"}
* @example
* {"name": "not-ok.md", "label": "input"}
*
* ```sh
* $ echo a
@ -47,7 +49,8 @@
* $ echo a > file
* ```
*
* @example {"name": "not-ok.md", "label": "output"}
* @example
* {"name": "not-ok.md", "label": "output"}
*
* 1:1-3:4: Do not use dollar signs before shell commands
* 5:1-8:4: Do not use dollar signs before shell commands

View File

@ -12,19 +12,22 @@
* rule still warns anyway.
* In that case, you can escape the reference like so: `!\[foo]`.
*
* @example {"name": "ok.md"}
* @example
* {"name": "ok.md"}
*
* ![foo][]
*
* [foo]: http://foo.bar/baz.png
*
* @example {"name": "not-ok.md", "label": "input"}
* @example
* {"name": "not-ok.md", "label": "input"}
*
* ![foo]
*
* [foo]: http://foo.bar/baz.png
*
* @example {"name": "not-ok.md", "label": "output"}
* @example
* {"name": "not-ok.md", "label": "output"}
*
* 1:1-1:7: Use the trailing [] on reference images
*/

View File

@ -12,19 +12,22 @@
* rule still warns anyway.
* In that case, you can escape the reference like so: `\[foo]`.
*
* @example {"name": "ok.md"}
* @example
* {"name": "ok.md"}
*
* [foo][]
*
* [foo]: http://foo.bar/baz
*
* @example {"name": "not-ok.md", "label": "input"}
* @example
* {"name": "not-ok.md", "label": "input"}
*
* [foo]
*
* [foo]: http://foo.bar/baz
*
* @example {"name": "not-ok.md", "label": "output"}
* @example
* {"name": "not-ok.md", "label": "output"}
*
* 1:1-1:6: Use the trailing `[]` on reference links
*/

View File

@ -14,7 +14,8 @@
* See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown)
* on how to automatically fix warnings for this rule.
*
* @example {"name": "ok.md", "gfm": true}
* @example
* {"name": "ok.md", "gfm": true}
*
* Paragraph.
*
@ -22,7 +23,8 @@
* | ----- | ----- |
* | Alpha | Bravo |
*
* @example {"name": "not-ok.md", "label": "input", "gfm": true}
* @example
* {"name": "not-ok.md", "label": "input", "gfm": true}
*
* Paragraph.
*
@ -30,29 +32,34 @@
* ···| ----- | ----- |
* ···| Alpha | Bravo |
*
* @example {"name": "not-ok.md", "label": "output", "gfm": true}
* @example
* {"name": "not-ok.md", "label": "output", "gfm": true}
*
* 3:4: Do not indent table rows
* 4:4: Do not indent table rows
* 5:4: Do not indent table rows
*
* @example {"name": "not-ok-blockquote.md", "label": "input", "gfm": true}
* @example
* {"name": "not-ok-blockquote.md", "label": "input", "gfm": true}
*
* >··| A |
* >·| - |
*
* @example {"name": "not-ok-blockquote.md", "label": "output", "gfm": true}
* @example
* {"name": "not-ok-blockquote.md", "label": "output", "gfm": true}
*
* 1:4: Do not indent table rows
*
* @example {"name": "not-ok-list.md", "label": "input", "gfm": true}
* @example
* {"name": "not-ok-list.md", "label": "input", "gfm": true}
*
* -···paragraph
*
* ·····| A |
* ····| - |
*
* @example {"name": "not-ok-list.md", "label": "output", "gfm": true}
* @example
* {"name": "not-ok-list.md", "label": "output", "gfm": true}
*
* 3:6: Do not indent table rows
*/

View File

@ -15,13 +15,15 @@
* See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown)
* on how to automatically fix warnings for this rule.
*
* @example {"name": "ok.md"}
* @example
* {"name": "ok.md"}
*
* Foo Bar
*
* ····Foo
*
* @example {"name": "not-ok.md", "label": "input", "positionless": true}
* @example
* {"name": "not-ok.md", "label": "input", "positionless": true}
*
* »Here's one before a code block.
*
@ -37,7 +39,8 @@
*
* And this is a tab as the last character.»
*
* @example {"name": "not-ok.md", "label": "output"}
* @example
* {"name": "not-ok.md", "label": "output"}
*
* 1:1: Use spaces instead of tabs
* 3:14: Use spaces instead of tabs

View File

@ -12,7 +12,8 @@
* appear between `[` and `]`, but that should not be treated as link
* identifiers.
*
* @example {"name": "ok.md"}
* @example
* {"name": "ok.md"}
*
* [foo][]
*
@ -25,11 +26,13 @@
*
* [foo]: https://example.com
*
* @example {"name": "ok-allow.md", "setting": {"allow": ["...", "…"]}}
* @example
* {"name": "ok-allow.md", "setting": {"allow": ["...", "…"]}}
*
* > Eliding a portion of a quoted passage [] is acceptable.
*
* @example {"name": "not-ok.md", "label": "input"}
* @example
* {"name": "not-ok.md", "label": "input"}
*
* [bar]
*
@ -49,7 +52,8 @@
*
* Multiple pairs: [a][b][c].
*
* @example {"name": "not-ok.md", "label": "output"}
* @example
* {"name": "not-ok.md", "label": "output"}
*
* 1:1-1:6: Found reference to undefined definition
* 3:1-3:8: Found reference to undefined definition

View File

@ -10,7 +10,8 @@
* collapsed reference (`[Remark][]`) if normalising the reference text yields
* the label.
*
* @example {"name": "ok.md"}
* @example
* {"name": "ok.md"}
*
* ![alpha][]
* ![Bravo][]
@ -20,7 +21,8 @@
* [bravo]: b
* [delta]: d
*
* @example {"name": "not-ok.md", "label": "input"}
* @example
* {"name": "not-ok.md", "label": "input"}
*
* ![alpha][alpha]
* ![Bravo][bravo]
@ -30,7 +32,8 @@
* [bravo]: b
* [charlie]: c
*
* @example {"name": "not-ok.md", "label": "output"}
* @example
* {"name": "not-ok.md", "label": "output"}
*
* 1:1-1:16: Remove the image label as it matches the reference text
* 2:1-2:16: Remove the image label as it matches the reference text

View File

@ -10,7 +10,8 @@
* collapsed reference (`[Remark][]`) if normalising the reference text yields
* the label.
*
* @example {"name": "ok.md"}
* @example
* {"name": "ok.md"}
*
* [alpha][]
* [Bravo][]
@ -26,7 +27,8 @@
* [`echo`]: e
* [*foxtrot*]: f
*
* @example {"name": "not-ok.md", "label": "input"}
* @example
* {"name": "not-ok.md", "label": "input"}
*
* [alpha][alpha]
* [Bravo][bravo]
@ -36,7 +38,8 @@
* [bravo]: b
* [charlie]: c
*
* @example {"name": "not-ok.md", "label": "output"}
* @example
* {"name": "not-ok.md", "label": "output"}
*
* 1:1-1:15: Remove the link label as it matches the reference text
* 2:1-2:15: Remove the link label as it matches the reference text

View File

@ -6,17 +6,20 @@
* @fileoverview
* Warn when unused definitions are found.
*
* @example {"name": "ok.md"}
* @example
* {"name": "ok.md"}
*
* [foo][]
*
* [foo]: https://example.com
*
* @example {"name": "not-ok.md", "label": "input"}
* @example
* {"name": "not-ok.md", "label": "input"}
*
* [bar]: https://example.com
*
* @example {"name": "not-ok.md", "label": "output"}
* @example
* {"name": "not-ok.md", "label": "output"}
*
* 1:1-1:27: Found unused definition
*/

View File

@ -11,7 +11,8 @@
* `'consistent'` detects the first used list style and warns when subsequent
* lists use different styles.
*
* @example {"name": "ok.md"}
* @example
* {"name": "ok.md"}
*
* 1. Foo
*
@ -22,29 +23,34 @@
*
* * Foo
*
* @example {"name": "ok.md", "setting": "."}
* @example
* {"name": "ok.md", "setting": "."}
*
* 1. Foo
*
* 2. Bar
*
* @example {"name": "ok.md", "setting": ")"}
* @example
* {"name": "ok.md", "setting": ")"}
*
* 1) Foo
*
* 2) Bar
*
* @example {"name": "not-ok.md", "label": "input"}
* @example
* {"name": "not-ok.md", "label": "input"}
*
* 1. Foo
*
* 2) Bar
*
* @example {"name": "not-ok.md", "label": "output"}
* @example
* {"name": "not-ok.md", "label": "output"}
*
* 3:1-3:8: Marker style should be `.`
*
* @example {"name": "not-ok.md", "label": "output", "setting": "💩", "positionless": true}
* @example
* {"name": "not-ok.md", "label": "output", "setting": "💩", "positionless": true}
*
* 1:1: Incorrect ordered list item marker style `💩`: use either `'.'` or `')'`
*/

View File

@ -27,7 +27,8 @@
* See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown)
* on how to automatically fix warnings for this rule.
*
* @example {"name": "ok.md"}
* @example
* {"name": "ok.md"}
*
* The default value is `ordered`, so unless changed, the below
* is OK.
@ -46,7 +47,8 @@
*
* * Anton
*
* @example {"name": "ok.md", "setting": "one"}
* @example
* {"name": "ok.md", "setting": "one"}
*
* 1. Foo
* 1. Bar
@ -58,7 +60,8 @@
* 1. Bravo
* 1. Charlie
*
* @example {"name": "ok.md", "setting": "single"}
* @example
* {"name": "ok.md", "setting": "single"}
*
* 1. Foo
* 1. Bar
@ -76,7 +79,8 @@
* 0. Echo
* 0. Foxtrot
*
* @example {"name": "ok.md", "setting": "ordered"}
* @example
* {"name": "ok.md", "setting": "ordered"}
*
* 1. Foo
* 2. Bar
@ -94,34 +98,41 @@
* 1. Echo
* 2. Foxtrot
*
* @example {"name": "not-ok.md", "setting": "one", "label": "input"}
* @example
* {"name": "not-ok.md", "setting": "one", "label": "input"}
*
* 1. Foo
* 2. Bar
*
* @example {"name": "not-ok.md", "setting": "one", "label": "output"}
* @example
* {"name": "not-ok.md", "setting": "one", "label": "output"}
*
* 2:1-2:8: Marker should be `1`, was `2`
*
* @example {"name": "also-not-ok.md", "setting": "one", "label": "input"}
* @example
* {"name": "also-not-ok.md", "setting": "one", "label": "input"}
*
* 2. Foo
* 1. Bar
*
* @example {"name": "also-not-ok.md", "setting": "one", "label": "output"}
* @example
* {"name": "also-not-ok.md", "setting": "one", "label": "output"}
*
* 1:1-1:8: Marker should be `1`, was `2`
*
* @example {"name": "not-ok.md", "setting": "ordered", "label": "input"}
* @example
* {"name": "not-ok.md", "setting": "ordered", "label": "input"}
*
* 1. Foo
* 1. Bar
*
* @example {"name": "not-ok.md", "setting": "ordered", "label": "output"}
* @example
* {"name": "not-ok.md", "setting": "ordered", "label": "output"}
*
* 2:1-2:8: Marker should be `2`, was `1`
*
* @example {"name": "not-ok.md", "setting": "💩", "label": "output", "positionless": true}
* @example
* {"name": "not-ok.md", "setting": "💩", "label": "output", "positionless": true}
*
* 1:1: Incorrect ordered list item marker value `💩`: use either `'ordered'` or `'one'`
*/

View File

@ -28,29 +28,34 @@
* See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown)
* on how to automatically fix warnings for this rule.
*
* @example {"name": "ok.md", "setting": "* * *"}
* @example
* {"name": "ok.md", "setting": "* * *"}
*
* * * *
*
* * * *
*
* @example {"name": "ok.md", "setting": "_______"}
* @example
* {"name": "ok.md", "setting": "_______"}
*
* _______
*
* _______
*
* @example {"name": "not-ok.md", "label": "input"}
* @example
* {"name": "not-ok.md", "label": "input"}
*
* ***
*
* * * *
*
* @example {"name": "not-ok.md", "label": "output"}
* @example
* {"name": "not-ok.md", "label": "output"}
*
* 3:1-3:6: Rules should use `***`
*
* @example {"name": "not-ok.md", "label": "output", "setting": "💩", "positionless": true}
* @example
* {"name": "not-ok.md", "label": "output", "setting": "💩", "positionless": true}
*
* 1:1: Incorrect preferred rule style: provide a correct markdown rule or `'consistent'`
*/

View File

@ -16,40 +16,49 @@
* See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown)
* on how to automatically fix warnings for this rule.
*
* @example {"setting": "~", "name": "ok.md", "gfm": true}
* @example
* {"setting": "~", "name": "ok.md", "gfm": true}
*
* ~foo~
*
* @example {"setting": "~", "name": "not-ok.md", "label": "input", "gfm": true}
* @example
* {"setting": "~", "name": "not-ok.md", "label": "input", "gfm": true}
*
* ~~foo~~
*
* @example {"setting": "~", "name": "not-ok.md", "label": "output", "gfm": true}
* @example
* {"setting": "~", "name": "not-ok.md", "label": "output", "gfm": true}
*
* 1:1-1:8: Strikethrough should use `~` as a marker
*
* @example {"setting": "~~", "name": "ok.md", "gfm": true}
* @example
* {"setting": "~~", "name": "ok.md", "gfm": true}
*
* ~~foo~~
*
* @example {"setting": "~~", "name": "not-ok.md", "label": "input", "gfm": true}
* @example
* {"setting": "~~", "name": "not-ok.md", "label": "input", "gfm": true}
*
* ~foo~
*
* @example {"setting": "~~", "name": "not-ok.md", "label": "output", "gfm": true}
* @example
* {"setting": "~~", "name": "not-ok.md", "label": "output", "gfm": true}
*
* 1:1-1:6: Strikethrough should use `~~` as a marker
*
* @example {"name": "not-ok.md", "label": "input", "gfm": true}
* @example
* {"name": "not-ok.md", "label": "input", "gfm": true}
*
* ~~foo~~
* ~bar~
*
* @example {"name": "not-ok.md", "label": "output", "gfm": true}
* @example
* {"name": "not-ok.md", "label": "output", "gfm": true}
*
* 2:1-2:6: Strikethrough should use `~~` as a marker
*
* @example {"setting": "💩", "name": "not-ok.md", "label": "output", "positionless": true, "gfm": true}
* @example
* {"setting": "💩", "name": "not-ok.md", "label": "output", "positionless": true, "gfm": true}
*
* 1:1: Incorrect strikethrough marker `💩`: use either `'consistent'`, `'~'`, or `'~~'`
*/

View File

@ -22,31 +22,38 @@
* See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown)
* on how to automatically fix warnings for this rule.
*
* @example {"name": "ok.md"}
* @example
* {"name": "ok.md"}
*
* **foo** and **bar**.
*
* @example {"name": "also-ok.md"}
* @example
* {"name": "also-ok.md"}
*
* __foo__ and __bar__.
*
* @example {"name": "ok.md", "setting": "*"}
* @example
* {"name": "ok.md", "setting": "*"}
*
* **foo**.
*
* @example {"name": "ok.md", "setting": "_"}
* @example
* {"name": "ok.md", "setting": "_"}
*
* __foo__.
*
* @example {"name": "not-ok.md", "label": "input"}
* @example
* {"name": "not-ok.md", "label": "input"}
*
* **foo** and __bar__.
*
* @example {"name": "not-ok.md", "label": "output"}
* @example
* {"name": "not-ok.md", "label": "output"}
*
* 1:13-1:20: Strong should use `*` as a marker
*
* @example {"name": "not-ok.md", "label": "output", "setting": "💩", "positionless": true}
* @example
* {"name": "not-ok.md", "label": "output", "setting": "💩", "positionless": true}
*
* 1:1: Incorrect strong marker `💩`: use either `'consistent'`, `'*'`, or `'_'`
*/

View File

@ -22,13 +22,15 @@
* See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown)
* on how to automatically fix warnings for this rule.
*
* @example {"name": "ok.md", "setting": "padded", "gfm": true}
* @example
* {"name": "ok.md", "setting": "padded", "gfm": true}
*
* | A | B |
* | ----- | ----- |
* | Alpha | Bravo |
*
* @example {"name": "not-ok.md", "label": "input", "setting": "padded", "gfm": true}
* @example
* {"name": "not-ok.md", "label": "input", "setting": "padded", "gfm": true}
*
* | A | B |
* | :----|----: |
@ -44,7 +46,8 @@
* | :---- | -------- | :----: | -----: |
* | Echo | Foxtrot | Golf | Hotel |
*
* @example {"name": "not-ok.md", "label": "output", "setting": "padded", "gfm": true}
* @example
* {"name": "not-ok.md", "label": "output", "setting": "padded", "gfm": true}
*
* 3:8: Cell should be padded
* 3:9: Cell should be padded
@ -56,13 +59,15 @@
* 13:29: Cell should be padded with 1 space, not 2
* 13:30: Cell should be padded with 1 space, not 2
*
* @example {"name": "ok.md", "setting": "compact", "gfm": true}
* @example
* {"name": "ok.md", "setting": "compact", "gfm": true}
*
* |A |B |
* |-----|-----|
* |Alpha|Bravo|
*
* @example {"name": "not-ok.md", "label": "input", "setting": "compact", "gfm": true}
* @example
* {"name": "not-ok.md", "label": "input", "setting": "compact", "gfm": true}
*
* | A | B |
* | -----| -----|
@ -72,13 +77,15 @@
* |:------|-----:|
* |Charlie|Delta |
*
* @example {"name": "not-ok.md", "label": "output", "setting": "compact", "gfm": true}
* @example
* {"name": "not-ok.md", "label": "output", "setting": "compact", "gfm": true}
*
* 3:2: Cell should be compact
* 3:11: Cell should be compact
* 7:16: Cell should be compact
*
* @example {"name": "ok-padded.md", "setting": "consistent", "gfm": true}
* @example
* {"name": "ok-padded.md", "setting": "consistent", "gfm": true}
*
* | A | B |
* | ----- | ----- |
@ -88,7 +95,8 @@
* | ------- | ----- |
* | Charlie | Delta |
*
* @example {"name": "not-ok-padded.md", "label": "input", "setting": "consistent", "gfm": true}
* @example
* {"name": "not-ok-padded.md", "label": "input", "setting": "consistent", "gfm": true}
*
* | A | B |
* | ----- | ----- |
@ -98,11 +106,13 @@
* | :----- | ----: |
* |Charlie | Delta |
*
* @example {"name": "not-ok-padded.md", "label": "output", "setting": "consistent", "gfm": true}
* @example
* {"name": "not-ok-padded.md", "label": "output", "setting": "consistent", "gfm": true}
*
* 7:2: Cell should be padded
*
* @example {"name": "ok-compact.md", "setting": "consistent", "gfm": true}
* @example
* {"name": "ok-compact.md", "setting": "consistent", "gfm": true}
*
* |A |B |
* |-----|-----|
@ -112,7 +122,8 @@
* |-------|-----|
* |Charlie|Delta|
*
* @example {"name": "not-ok-compact.md", "label": "input", "setting": "consistent", "gfm": true}
* @example
* {"name": "not-ok-compact.md", "label": "input", "setting": "consistent", "gfm": true}
*
* |A |B |
* |-----|-----|
@ -122,15 +133,18 @@
* |:------|-----:|
* |Charlie|Delta |
*
* @example {"name": "not-ok-compact.md", "label": "output", "setting": "consistent", "gfm": true}
* @example
* {"name": "not-ok-compact.md", "label": "output", "setting": "consistent", "gfm": true}
*
* 7:16: Cell should be compact
*
* @example {"name": "not-ok.md", "label": "output", "setting": "💩", "positionless": true, "gfm": true}
* @example
* {"name": "not-ok.md", "label": "output", "setting": "💩", "positionless": true, "gfm": true}
*
* 1:1: Incorrect table cell padding style `💩`, expected `'padded'`, `'compact'`, or `'consistent'`
*
* @example {"name": "empty.md", "label": "input", "setting": "padded", "gfm": true}
* @example
* {"name": "empty.md", "label": "input", "setting": "padded", "gfm": true}
*
* <!-- Empty cells are OK, but those surrounding them may not be. -->
*
@ -138,13 +152,15 @@
* | ------ | ----- | ---: |
* | Charlie| | Echo|
*
* @example {"name": "empty.md", "label": "output", "setting": "padded", "gfm": true}
* @example
* {"name": "empty.md", "label": "output", "setting": "padded", "gfm": true}
*
* 3:25: Cell should be padded
* 5:10: Cell should be padded
* 5:25: Cell should be padded
*
* @example {"name": "missing-body.md", "setting": "padded", "gfm": true}
* @example
* {"name": "missing-body.md", "setting": "padded", "gfm": true}
*
* <!-- Missing cells are fine as well. -->
*

View File

@ -25,19 +25,22 @@
* See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown)
* on how to automatically fix warnings for this rule.
*
* @example {"name": "ok.md", "gfm": true}
* @example
* {"name": "ok.md", "gfm": true}
*
* | A | B |
* | ----- | ----- |
* | Alpha | Bravo |
*
* @example {"name": "not-ok.md", "label": "input", "gfm": true}
* @example
* {"name": "not-ok.md", "label": "input", "gfm": true}
*
* | A | B |
* | -- | -- |
* | Alpha | Bravo |
*
* @example {"name": "not-ok.md", "label": "output", "gfm": true}
* @example
* {"name": "not-ok.md", "label": "output", "gfm": true}
*
* 3:9-3:10: Misaligned table fence
* 3:17-3:18: Misaligned table fence

View File

@ -17,19 +17,22 @@
* See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown)
* on how to automatically fix warnings for this rule.
*
* @example {"name": "ok.md", "gfm": true}
* @example
* {"name": "ok.md", "gfm": true}
*
* | A | B |
* | ----- | ----- |
* | Alpha | Bravo |
*
* @example {"name": "not-ok.md", "label": "input", "gfm": true}
* @example
* {"name": "not-ok.md", "label": "input", "gfm": true}
*
* A | B
* ----- | -----
* Alpha | Bravo
*
* @example {"name": "not-ok.md", "label": "output", "gfm": true}
* @example
* {"name": "not-ok.md", "label": "output", "gfm": true}
*
* 1:1: Missing initial pipe in table fence
* 1:10: Missing final pipe in table fence

View File

@ -23,7 +23,8 @@
* See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown)
* on how to automatically fix warnings for this rule.
*
* @example {"name": "ok.md"}
* @example
* {"name": "ok.md"}
*
* By default (`'consistent'`), if the file uses only one marker,
* thats OK.
@ -38,30 +39,36 @@
* 2. Bar
* 3. Baz
*
* @example {"name": "ok.md", "setting": "*"}
* @example
* {"name": "ok.md", "setting": "*"}
*
* * Foo
*
* @example {"name": "ok.md", "setting": "-"}
* @example
* {"name": "ok.md", "setting": "-"}
*
* - Foo
*
* @example {"name": "ok.md", "setting": "+"}
* @example
* {"name": "ok.md", "setting": "+"}
*
* + Foo
*
* @example {"name": "not-ok.md", "label": "input"}
* @example
* {"name": "not-ok.md", "label": "input"}
*
* * Foo
* - Bar
* + Baz
*
* @example {"name": "not-ok.md", "label": "output"}
* @example
* {"name": "not-ok.md", "label": "output"}
*
* 2:1-2:6: Marker style should be `*`
* 3:1-3:6: Marker style should be `*`
*
* @example {"name": "not-ok.md", "label": "output", "setting": "💩", "positionless": true}
* @example
* {"name": "not-ok.md", "label": "output", "setting": "💩", "positionless": true}
*
* 1:1: Incorrect unordered list item marker style `💩`: use either `'-'`, `'*'`, or `'+'`
*/

View File

@ -2,12 +2,11 @@ import fs from 'fs'
import path from 'path'
import {inspect} from 'util'
import {u} from 'unist-builder'
import dox from 'dox'
import {parse} from 'comment-parser'
import {remark} from 'remark'
import remarkGfm from 'remark-gfm'
import strip from 'strip-indent'
import parseAuthor from 'parse-author'
import {find} from './util/find.js'
import {presets} from './util/presets.js'
const pkg = JSON.parse(fs.readFileSync('package.json'))
@ -24,9 +23,11 @@ presets(root).then((presetObjects) => {
const base = path.resolve(root, name)
const pack = JSON.parse(fs.readFileSync(path.join(base, 'package.json')))
const doc = fs.readFileSync(path.join(base, 'index.js'), 'utf8')
const tags = dox.parseComments(doc)[0].tags
const tags = parse(doc, {spacing: 'preserve'})[0].tags
const author = parseAuthor(pack.author)
const description = strip(find(tags, 'fileoverview')).trim()
const description = strip(
tags.find((d) => d.tag === 'fileoverview').description
).trim()
const rows = []
let children
const short = name.replace(/^remark-/, '')

View File

@ -1,27 +0,0 @@
// Find the first tag in `tags` with a type set to `key`.
export function find(tags, key) {
let value = null
tags.some((tag) => {
if (tag && tag.type === key) {
value = tag
return true
}
return false
})
return value && value.string
}
// Find the first tag in `tags` with a type set to `key`.
export function findAll(tags, key) {
return tags
.filter((tag) => {
return tag && tag.type === key
})
.map((tag) => {
return tag.string
})
}

View File

@ -1,8 +1,7 @@
import fs from 'fs'
import path from 'path'
import dox from 'dox'
import {parse} from 'comment-parser'
import strip from 'strip-indent'
import {find, findAll} from './find.js'
// Get information for a rule at `filePath`.
export function rule(filePath) {
@ -10,9 +9,9 @@ export function rule(filePath) {
const result = {}
const tests = {}
const code = fs.readFileSync(path.join(filePath, 'index.js'), 'utf-8')
const tags = dox.parseComments(code)[0].tags
const name = find(tags, 'module')
let description = find(tags, 'fileoverview')
const tags = parse(code, {spacing: 'preserve'})[0].tags
const name = tags.find((d) => d.tag === 'module').name
let description = tags.find((d) => d.tag === 'fileoverview').description
/* c8 ignore next 3 */
if (name !== ruleId) {
@ -31,17 +30,18 @@ export function rule(filePath) {
result.tests = tests
result.filePath = filePath
const examples = findAll(tags, 'example')
const examples = tags
.filter((d) => d.tag === 'example')
.map((d) => d.description.replace(/^\r?\n|\r?\n$/g, ''))
let index = -1
while (++index < examples.length) {
const example = strip(examples[index])
const lines = example.split('\n')
const value = strip(lines.slice(1).join('\n'))
const lines = examples[index].split('\n')
let info
try {
info = JSON.parse(lines[0])
lines.splice(0, 1)
/* c8 ignore next 5 */
} catch (error) {
throw new Error(
@ -49,6 +49,7 @@ export function rule(filePath) {
)
}
const exampleValue = strip(lines.join('\n').replace(/^\r?\n/g, ''))
const setting = JSON.stringify(info.setting || true)
const name = info.name
let context = tests[setting]
@ -63,7 +64,7 @@ export function rule(filePath) {
positionless: info.positionless,
gfm: info.gfm,
setting,
input: value,
input: exampleValue,
output: []
}
@ -88,9 +89,9 @@ export function rule(filePath) {
context[name].setting = setting
if (info.label === 'output') {
context[name][info.label] = value.split('\n')
context[name][info.label] = exampleValue.split('\n')
} else {
context[name][info.label] = value
context[name][info.label] = exampleValue
}
}