markdownlint 0.26.2 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +378 -0
- package/CONTRIBUTING.md +82 -59
- package/LICENSE +1 -1
- package/README.md +304 -305
- package/demo/markdownlint-browser.js +4973 -3379
- package/doc/CustomRules.md +99 -51
- package/doc/Prettier.md +14 -10
- package/doc/ReleaseProcess.md +20 -0
- package/doc/Rules.md +474 -311
- package/doc/md001.md +37 -0
- package/doc/md002.md +37 -0
- package/doc/md003.md +59 -0
- package/doc/md004.md +49 -0
- package/doc/md005.md +53 -0
- package/doc/md006.md +46 -0
- package/doc/md007.md +55 -0
- package/doc/md009.md +51 -0
- package/doc/md010.md +56 -0
- package/doc/md011.md +30 -0
- package/doc/md012.md +38 -0
- package/doc/md013.md +60 -0
- package/doc/md014.md +54 -0
- package/doc/md018.md +27 -0
- package/doc/md019.md +28 -0
- package/doc/md020.md +29 -0
- package/doc/md021.md +31 -0
- package/doc/md022.md +46 -0
- package/doc/md023.md +26 -0
- package/doc/md024.md +47 -0
- package/doc/md025.md +49 -0
- package/doc/md026.md +41 -0
- package/doc/md027.md +24 -0
- package/doc/md028.md +40 -0
- package/doc/md029.md +98 -0
- package/doc/md030.md +82 -0
- package/doc/md031.md +50 -0
- package/doc/md032.md +38 -0
- package/doc/md033.md +27 -0
- package/doc/md034.md +50 -0
- package/doc/md035.md +42 -0
- package/doc/md036.md +45 -0
- package/doc/md037.md +37 -0
- package/doc/md038.md +40 -0
- package/doc/md039.md +21 -0
- package/doc/md040.md +52 -0
- package/doc/md041.md +49 -0
- package/doc/md042.md +32 -0
- package/doc/md043.md +72 -0
- package/doc/md044.md +35 -0
- package/doc/md045.md +34 -0
- package/doc/md046.md +40 -0
- package/doc/md047.md +34 -0
- package/doc/md048.md +41 -0
- package/doc/md049.md +32 -0
- package/doc/md050.md +32 -0
- package/doc/md051.md +50 -0
- package/doc/md052.md +33 -0
- package/doc/md053.md +38 -0
- package/helpers/LICENSE +1 -1
- package/helpers/README.md +35 -15
- package/helpers/helpers.js +182 -162
- package/helpers/micromark.cjs +209 -0
- package/helpers/package.json +5 -2
- package/lib/constants.js +8 -1
- package/lib/markdownlint.d.ts +5 -5
- package/lib/markdownlint.js +46 -24
- package/lib/md002.js +1 -1
- package/lib/md011.js +2 -2
- package/lib/md013.js +7 -6
- package/lib/md019.js +1 -1
- package/lib/md022.js +15 -3
- package/lib/md023.js +1 -1
- package/lib/md026.js +1 -1
- package/lib/md027.js +1 -1
- package/lib/md028.js +1 -1
- package/lib/md033.js +47 -29
- package/lib/md034.js +54 -47
- package/lib/md035.js +9 -11
- package/lib/md036.js +1 -1
- package/lib/md037.js +2 -2
- package/lib/md038.js +81 -56
- package/lib/md039.js +1 -1
- package/lib/md040.js +21 -2
- package/lib/md041.js +1 -1
- package/lib/md043.js +4 -2
- package/lib/md044.js +58 -43
- package/lib/md046.js +1 -1
- package/lib/md048.js +3 -1
- package/lib/md051.js +37 -5
- package/lib/rules.js +1 -1
- package/package.json +43 -28
- package/schema/.markdownlint.jsonc +11 -4
- package/schema/.markdownlint.yaml +11 -6
- package/schema/markdownlint-config-schema.json +27 -3
- package/style/prettier.json +26 -0
package/doc/md001.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# `MD001` - Heading levels should only increment by one level at a time
|
|
2
|
+
|
|
3
|
+
Tags: `headers`, `headings`
|
|
4
|
+
|
|
5
|
+
Aliases: `header-increment`, `heading-increment`
|
|
6
|
+
|
|
7
|
+
This rule is triggered when you skip heading levels in a Markdown document, for
|
|
8
|
+
example:
|
|
9
|
+
|
|
10
|
+
```markdown
|
|
11
|
+
# Heading 1
|
|
12
|
+
|
|
13
|
+
### Heading 3
|
|
14
|
+
|
|
15
|
+
We skipped out a 2nd level heading in this document
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
When using multiple heading levels, nested headings should increase by only one
|
|
19
|
+
level at a time:
|
|
20
|
+
|
|
21
|
+
```markdown
|
|
22
|
+
# Heading 1
|
|
23
|
+
|
|
24
|
+
## Heading 2
|
|
25
|
+
|
|
26
|
+
### Heading 3
|
|
27
|
+
|
|
28
|
+
#### Heading 4
|
|
29
|
+
|
|
30
|
+
## Another Heading 2
|
|
31
|
+
|
|
32
|
+
### Another Heading 3
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Rationale: Headings represent the structure of a document and can be confusing
|
|
36
|
+
when skipped - especially for accessibility scenarios. More information:
|
|
37
|
+
<https://www.w3.org/WAI/tutorials/page-structure/headings/>.
|
package/doc/md002.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# ~~`MD002` - First heading should be a top-level heading~~
|
|
2
|
+
|
|
3
|
+
> This rule is deprecated and provided for backward-compatibility
|
|
4
|
+
|
|
5
|
+
Tags: `headers`, `headings`
|
|
6
|
+
|
|
7
|
+
Aliases: `first-header-h1`, `first-heading-h1`
|
|
8
|
+
|
|
9
|
+
Parameters:
|
|
10
|
+
|
|
11
|
+
- `level`: Heading level (`integer`, default `1`)
|
|
12
|
+
|
|
13
|
+
> Note: *MD002 has been deprecated and is disabled by default.*
|
|
14
|
+
> [MD041/first-line-heading](md041.md) offers an improved implementation.
|
|
15
|
+
|
|
16
|
+
This rule is intended to ensure document headings start at the top level and
|
|
17
|
+
is triggered when the first heading in the document isn't an h1 heading:
|
|
18
|
+
|
|
19
|
+
```markdown
|
|
20
|
+
## This isn't an H1 heading
|
|
21
|
+
|
|
22
|
+
### Another heading
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
The first heading in the document should be an h1 heading:
|
|
26
|
+
|
|
27
|
+
```markdown
|
|
28
|
+
# Start with an H1 heading
|
|
29
|
+
|
|
30
|
+
## Then use an H2 for subsections
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Note: The `level` parameter can be used to change the top-level (ex: to h2) in
|
|
34
|
+
cases where an h1 is added externally.
|
|
35
|
+
|
|
36
|
+
Rationale: The top-level heading often acts as the title of a document. More
|
|
37
|
+
information: <https://cirosantilli.com/markdown-style-guide#top-level-header>.
|
package/doc/md003.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# `MD003` - Heading style
|
|
2
|
+
|
|
3
|
+
Tags: `headers`, `headings`
|
|
4
|
+
|
|
5
|
+
Aliases: `header-style`, `heading-style`
|
|
6
|
+
|
|
7
|
+
Parameters:
|
|
8
|
+
|
|
9
|
+
- `style`: Heading style (`string`, default `consistent`, values `atx` /
|
|
10
|
+
`atx_closed` / `consistent` / `setext` / `setext_with_atx` /
|
|
11
|
+
`setext_with_atx_closed`)
|
|
12
|
+
|
|
13
|
+
This rule is triggered when different heading styles are used in the same
|
|
14
|
+
document:
|
|
15
|
+
|
|
16
|
+
```markdown
|
|
17
|
+
# ATX style H1
|
|
18
|
+
|
|
19
|
+
## Closed ATX style H2 ##
|
|
20
|
+
|
|
21
|
+
Setext style H1
|
|
22
|
+
===============
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
To fix the issue, use consistent heading styles throughout the document:
|
|
26
|
+
|
|
27
|
+
```markdown
|
|
28
|
+
# ATX style H1
|
|
29
|
+
|
|
30
|
+
## ATX style H2
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
The `setext_with_atx` and `setext_with_atx_closed` settings allow ATX-style
|
|
34
|
+
headings of level 3 or more in documents with setext-style headings (which only
|
|
35
|
+
support level 1 and 2 headings):
|
|
36
|
+
|
|
37
|
+
```markdown
|
|
38
|
+
Setext style H1
|
|
39
|
+
===============
|
|
40
|
+
|
|
41
|
+
Setext style H2
|
|
42
|
+
---------------
|
|
43
|
+
|
|
44
|
+
### ATX style H3
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Note: The configured heading style can be a specific style to require (`atx`,
|
|
48
|
+
`atx_closed`, `setext`, `setext_with_atx`, `setext_with_atx_closed`), or may
|
|
49
|
+
just require that usage is consistent within the document via `consistent`.
|
|
50
|
+
|
|
51
|
+
Note: The placement of a horizontal rule directly below a line of text can
|
|
52
|
+
trigger this rule by turning that text into a level 2 setext-style heading:
|
|
53
|
+
|
|
54
|
+
```markdown
|
|
55
|
+
A line of text followed by a horizontal rule becomes a heading
|
|
56
|
+
---
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Rationale: Consistent formatting makes it easier to understand a document.
|
package/doc/md004.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# `MD004` - Unordered list style
|
|
2
|
+
|
|
3
|
+
Tags: `bullet`, `ul`
|
|
4
|
+
|
|
5
|
+
Aliases: `ul-style`
|
|
6
|
+
|
|
7
|
+
Parameters:
|
|
8
|
+
|
|
9
|
+
- `style`: List style (`string`, default `consistent`, values `asterisk` /
|
|
10
|
+
`consistent` / `dash` / `plus` / `sublist`)
|
|
11
|
+
|
|
12
|
+
Fixable: Some violations can be fixed by tooling
|
|
13
|
+
|
|
14
|
+
This rule is triggered when the symbols used in the document for unordered
|
|
15
|
+
list items do not match the configured unordered list style:
|
|
16
|
+
|
|
17
|
+
```markdown
|
|
18
|
+
* Item 1
|
|
19
|
+
+ Item 2
|
|
20
|
+
- Item 3
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
To fix this issue, use the configured style for list items throughout the
|
|
24
|
+
document:
|
|
25
|
+
|
|
26
|
+
```markdown
|
|
27
|
+
* Item 1
|
|
28
|
+
* Item 2
|
|
29
|
+
* Item 3
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The configured list style can be a specific symbol to use (asterisk, plus,
|
|
33
|
+
dash), to ensure that all list styling is consistent, or to ensure that each
|
|
34
|
+
sublist has a consistent symbol that differs from its parent list.
|
|
35
|
+
|
|
36
|
+
For example, the following is valid for the `sublist` style because the
|
|
37
|
+
outer-most indent uses asterisk, the middle indent uses plus, and the inner-most
|
|
38
|
+
indent uses dash:
|
|
39
|
+
|
|
40
|
+
```markdown
|
|
41
|
+
* Item 1
|
|
42
|
+
+ Item 2
|
|
43
|
+
- Item 3
|
|
44
|
+
+ Item 4
|
|
45
|
+
* Item 4
|
|
46
|
+
+ Item 5
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Rationale: Consistent formatting makes it easier to understand a document.
|
package/doc/md005.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# `MD005` - Inconsistent indentation for list items at the same level
|
|
2
|
+
|
|
3
|
+
Tags: `bullet`, `indentation`, `ul`
|
|
4
|
+
|
|
5
|
+
Aliases: `list-indent`
|
|
6
|
+
|
|
7
|
+
Fixable: Some violations can be fixed by tooling
|
|
8
|
+
|
|
9
|
+
This rule is triggered when list items are parsed as being at the same level,
|
|
10
|
+
but don't have the same indentation:
|
|
11
|
+
|
|
12
|
+
```markdown
|
|
13
|
+
* Item 1
|
|
14
|
+
* Nested Item 1
|
|
15
|
+
* Nested Item 2
|
|
16
|
+
* A misaligned item
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Usually, this rule will be triggered because of a typo. Correct the indentation
|
|
20
|
+
for the list to fix it:
|
|
21
|
+
|
|
22
|
+
```markdown
|
|
23
|
+
* Item 1
|
|
24
|
+
* Nested Item 1
|
|
25
|
+
* Nested Item 2
|
|
26
|
+
* Nested Item 3
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Sequentially-ordered list markers are usually left-aligned such that all items
|
|
30
|
+
have the same starting column:
|
|
31
|
+
|
|
32
|
+
```markdown
|
|
33
|
+
...
|
|
34
|
+
8. Item
|
|
35
|
+
9. Item
|
|
36
|
+
10. Item
|
|
37
|
+
11. Item
|
|
38
|
+
...
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
This rule also supports right-alignment of list markers such that all items have
|
|
42
|
+
the same ending column:
|
|
43
|
+
|
|
44
|
+
```markdown
|
|
45
|
+
...
|
|
46
|
+
8. Item
|
|
47
|
+
9. Item
|
|
48
|
+
10. Item
|
|
49
|
+
11. Item
|
|
50
|
+
...
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Rationale: Violations of this rule can lead to improperly rendered content.
|
package/doc/md006.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# ~~`MD006` - Consider starting bulleted lists at the beginning of the line~~
|
|
2
|
+
|
|
3
|
+
> This rule is deprecated and provided for backward-compatibility
|
|
4
|
+
|
|
5
|
+
Tags: `bullet`, `indentation`, `ul`
|
|
6
|
+
|
|
7
|
+
Aliases: `ul-start-left`
|
|
8
|
+
|
|
9
|
+
Fixable: Some violations can be fixed by tooling
|
|
10
|
+
|
|
11
|
+
This rule is triggered when top-level lists don't start at the beginning of a
|
|
12
|
+
line:
|
|
13
|
+
|
|
14
|
+
```markdown
|
|
15
|
+
Some text
|
|
16
|
+
|
|
17
|
+
* List item
|
|
18
|
+
* List item
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
To fix, ensure that top-level list items are not indented:
|
|
22
|
+
|
|
23
|
+
```markdown
|
|
24
|
+
Some test
|
|
25
|
+
|
|
26
|
+
* List item
|
|
27
|
+
* List item
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Note: This rule is triggered for the following scenario because the unordered
|
|
31
|
+
sublist is not recognized as such by the parser. Not being nested 3 characters
|
|
32
|
+
as required by the outer ordered list, it creates a top-level unordered list
|
|
33
|
+
instead.
|
|
34
|
+
|
|
35
|
+
```markdown
|
|
36
|
+
1. List item
|
|
37
|
+
- List item
|
|
38
|
+
- List item
|
|
39
|
+
1. List item
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Rationale: Starting lists at the beginning of the line means that nested list
|
|
43
|
+
items can all be indented by the same amount when an editor's indent function
|
|
44
|
+
or the tab key is used to indent. Starting a list 1 space in means that the
|
|
45
|
+
indent of the first nested list is less than the indent of the second level (3
|
|
46
|
+
characters if you use 4 space tabs, or 1 character if you use 2 space tabs).
|
package/doc/md007.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# `MD007` - Unordered list indentation
|
|
2
|
+
|
|
3
|
+
Tags: `bullet`, `indentation`, `ul`
|
|
4
|
+
|
|
5
|
+
Aliases: `ul-indent`
|
|
6
|
+
|
|
7
|
+
Parameters:
|
|
8
|
+
|
|
9
|
+
- `indent`: Spaces for indent (`integer`, default `2`)
|
|
10
|
+
- `start_indent`: Spaces for first level indent (when start_indented is set)
|
|
11
|
+
(`integer`, default `2`)
|
|
12
|
+
- `start_indented`: Whether to indent the first level of the list (`boolean`,
|
|
13
|
+
default `false`)
|
|
14
|
+
|
|
15
|
+
Fixable: Some violations can be fixed by tooling
|
|
16
|
+
|
|
17
|
+
This rule is triggered when list items are not indented by the configured
|
|
18
|
+
number of spaces (default: 2).
|
|
19
|
+
|
|
20
|
+
Example:
|
|
21
|
+
|
|
22
|
+
```markdown
|
|
23
|
+
* List item
|
|
24
|
+
* Nested list item indented by 3 spaces
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Corrected Example:
|
|
28
|
+
|
|
29
|
+
```markdown
|
|
30
|
+
* List item
|
|
31
|
+
* Nested list item indented by 2 spaces
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Note: This rule applies to a sublist only if its parent lists are all also
|
|
35
|
+
unordered (otherwise, extra indentation of ordered lists interferes with the
|
|
36
|
+
rule).
|
|
37
|
+
|
|
38
|
+
The `start_indented` parameter allows the first level of lists to be indented by
|
|
39
|
+
the configured number of spaces rather than starting at zero (the inverse of
|
|
40
|
+
MD006). The `start_indent` parameter allows the first level of lists to be
|
|
41
|
+
indented by a different number of spaces than the rest (ignored when
|
|
42
|
+
`start_indented` is not set).
|
|
43
|
+
|
|
44
|
+
Rationale: Indenting by 2 spaces allows the content of a nested list to be in
|
|
45
|
+
line with the start of the content of the parent list when a single space is
|
|
46
|
+
used after the list marker. Indenting by 4 spaces is consistent with code blocks
|
|
47
|
+
and simpler for editors to implement. Additionally, this can be a compatibility
|
|
48
|
+
issue for other Markdown parsers, which require 4-space indents. More
|
|
49
|
+
information: [Markdown Style Guide][markdown-style-guide] and [Marked app\
|
|
50
|
+
support][marked-app-support].
|
|
51
|
+
|
|
52
|
+
Note: See [Prettier.md](Prettier.md) for compatibility information.
|
|
53
|
+
|
|
54
|
+
[markdown-style-guide]: https://cirosantilli.com/markdown-style-guide#indentation-of-content-inside-lists
|
|
55
|
+
[marked-app-support]: http://support.markedapp.com/discussions/problems/21-sub-lists-not-indenting
|
package/doc/md009.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# `MD009` - Trailing spaces
|
|
2
|
+
|
|
3
|
+
Tags: `whitespace`
|
|
4
|
+
|
|
5
|
+
Aliases: `no-trailing-spaces`
|
|
6
|
+
|
|
7
|
+
Parameters:
|
|
8
|
+
|
|
9
|
+
- `br_spaces`: Spaces for line break (`integer`, default `2`)
|
|
10
|
+
- `list_item_empty_lines`: Allow spaces for empty lines in list items
|
|
11
|
+
(`boolean`, default `false`)
|
|
12
|
+
- `strict`: Include unnecessary breaks (`boolean`, default `false`)
|
|
13
|
+
|
|
14
|
+
Fixable: Some violations can be fixed by tooling
|
|
15
|
+
|
|
16
|
+
This rule is triggered on any lines that end with unexpected whitespace. To fix
|
|
17
|
+
this, remove the trailing space from the end of the line.
|
|
18
|
+
|
|
19
|
+
Note: Trailing space is allowed in indented and fenced code blocks because some
|
|
20
|
+
languages require it.
|
|
21
|
+
|
|
22
|
+
The `br_spaces` parameter allows an exception to this rule for a specific number
|
|
23
|
+
of trailing spaces, typically used to insert an explicit line break. The default
|
|
24
|
+
value allows 2 spaces to indicate a hard break (\<br> element).
|
|
25
|
+
|
|
26
|
+
Note: You must set `br_spaces` to a value >= 2 for this parameter to take
|
|
27
|
+
effect. Setting `br_spaces` to 1 behaves the same as 0, disallowing any trailing
|
|
28
|
+
spaces.
|
|
29
|
+
|
|
30
|
+
By default, this rule will not trigger when the allowed number of spaces is
|
|
31
|
+
used, even when it doesn't create a hard break (for example, at the end of a
|
|
32
|
+
paragraph). To report such instances as well, set the `strict` parameter to
|
|
33
|
+
`true`.
|
|
34
|
+
|
|
35
|
+
```markdown
|
|
36
|
+
Text text text
|
|
37
|
+
text[2 spaces]
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Using spaces to indent blank lines inside a list item is usually not necessary,
|
|
41
|
+
but some parsers require it. Set the `list_item_empty_lines` parameter to `true`
|
|
42
|
+
to allow this (even when `strict` is `true`):
|
|
43
|
+
|
|
44
|
+
```markdown
|
|
45
|
+
- list item text
|
|
46
|
+
[2 spaces]
|
|
47
|
+
list item text
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Rationale: Except when being used to create a line break, trailing whitespace
|
|
51
|
+
has no purpose and does not affect the rendering of content.
|
package/doc/md010.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# `MD010` - Hard tabs
|
|
2
|
+
|
|
3
|
+
Tags: `hard_tab`, `whitespace`
|
|
4
|
+
|
|
5
|
+
Aliases: `no-hard-tabs`
|
|
6
|
+
|
|
7
|
+
Parameters:
|
|
8
|
+
|
|
9
|
+
- `code_blocks`: Include code blocks (`boolean`, default `true`)
|
|
10
|
+
- `ignore_code_languages`: Fenced code languages to ignore (`string[]`, default
|
|
11
|
+
`[]`)
|
|
12
|
+
- `spaces_per_tab`: Number of spaces for each hard tab (`integer`, default `1`)
|
|
13
|
+
|
|
14
|
+
Fixable: Some violations can be fixed by tooling
|
|
15
|
+
|
|
16
|
+
This rule is triggered by any lines that contain hard tab characters instead
|
|
17
|
+
of using spaces for indentation. To fix this, replace any hard tab characters
|
|
18
|
+
with spaces instead.
|
|
19
|
+
|
|
20
|
+
Example:
|
|
21
|
+
|
|
22
|
+
<!-- markdownlint-disable no-hard-tabs -->
|
|
23
|
+
|
|
24
|
+
```markdown
|
|
25
|
+
Some text
|
|
26
|
+
|
|
27
|
+
* hard tab character used to indent the list item
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
<!-- markdownlint-restore -->
|
|
31
|
+
|
|
32
|
+
Corrected example:
|
|
33
|
+
|
|
34
|
+
```markdown
|
|
35
|
+
Some text
|
|
36
|
+
|
|
37
|
+
* Spaces used to indent the list item instead
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
You have the option to exclude this rule for code blocks and spans. To do so,
|
|
41
|
+
set the `code_blocks` parameter to `false`. Code blocks and spans are included
|
|
42
|
+
by default since handling of tabs by Markdown tools can be inconsistent (e.g.,
|
|
43
|
+
using 4 vs. 8 spaces).
|
|
44
|
+
|
|
45
|
+
When code blocks are scanned (e.g., by default or if `code_blocks` is `true`),
|
|
46
|
+
the `ignore_code_languages` parameter can be set to a list of languages that
|
|
47
|
+
should be ignored (i.e., hard tabs will be allowed, though not required). This
|
|
48
|
+
makes it easier for documents to include code for languages that require hard
|
|
49
|
+
tabs.
|
|
50
|
+
|
|
51
|
+
By default, violations of this rule are fixed by replacing the tab with 1 space
|
|
52
|
+
character. To use a different number of spaces, set the `spaces_per_tab`
|
|
53
|
+
parameter to the desired value.
|
|
54
|
+
|
|
55
|
+
Rationale: Hard tabs are often rendered inconsistently by different editors and
|
|
56
|
+
can be harder to work with than spaces.
|
package/doc/md011.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# `MD011` - Reversed link syntax
|
|
2
|
+
|
|
3
|
+
Tags: `links`
|
|
4
|
+
|
|
5
|
+
Aliases: `no-reversed-links`
|
|
6
|
+
|
|
7
|
+
Fixable: Some violations can be fixed by tooling
|
|
8
|
+
|
|
9
|
+
This rule is triggered when text that appears to be a link is encountered, but
|
|
10
|
+
where the syntax appears to have been reversed (the `[]` and `()` are
|
|
11
|
+
reversed):
|
|
12
|
+
|
|
13
|
+
```markdown
|
|
14
|
+
(Incorrect link syntax)[https://www.example.com/]
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
To fix this, swap the `[]` and `()` around:
|
|
18
|
+
|
|
19
|
+
```markdown
|
|
20
|
+
[Correct link syntax](https://www.example.com/)
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Note: [Markdown Extra](https://en.wikipedia.org/wiki/Markdown_Extra)-style
|
|
24
|
+
footnotes do not trigger this rule:
|
|
25
|
+
|
|
26
|
+
```markdown
|
|
27
|
+
For (example)[^1]
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Rationale: Reversed links are not rendered as usable links.
|
package/doc/md012.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# `MD012` - Multiple consecutive blank lines
|
|
2
|
+
|
|
3
|
+
Tags: `blank_lines`, `whitespace`
|
|
4
|
+
|
|
5
|
+
Aliases: `no-multiple-blanks`
|
|
6
|
+
|
|
7
|
+
Parameters:
|
|
8
|
+
|
|
9
|
+
- `maximum`: Consecutive blank lines (`integer`, default `1`)
|
|
10
|
+
|
|
11
|
+
Fixable: Some violations can be fixed by tooling
|
|
12
|
+
|
|
13
|
+
This rule is triggered when there are multiple consecutive blank lines in the
|
|
14
|
+
document:
|
|
15
|
+
|
|
16
|
+
```markdown
|
|
17
|
+
Some text here
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
Some more text here
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
To fix this, delete the offending lines:
|
|
24
|
+
|
|
25
|
+
```markdown
|
|
26
|
+
Some text here
|
|
27
|
+
|
|
28
|
+
Some more text here
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Note: this rule will not be triggered if there are multiple consecutive blank
|
|
32
|
+
lines inside code blocks.
|
|
33
|
+
|
|
34
|
+
Note: The `maximum` parameter can be used to configure the maximum number of
|
|
35
|
+
consecutive blank lines.
|
|
36
|
+
|
|
37
|
+
Rationale: Except in a code block, blank lines serve no purpose and do not
|
|
38
|
+
affect the rendering of content.
|
package/doc/md013.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# `MD013` - Line length
|
|
2
|
+
|
|
3
|
+
Tags: `line_length`
|
|
4
|
+
|
|
5
|
+
Aliases: `line-length`
|
|
6
|
+
|
|
7
|
+
Parameters:
|
|
8
|
+
|
|
9
|
+
- `code_block_line_length`: Number of characters for code blocks (`integer`,
|
|
10
|
+
default `80`)
|
|
11
|
+
- `code_blocks`: Include code blocks (`boolean`, default `true`)
|
|
12
|
+
- `headers`: Include headings (`boolean`, default `true`)
|
|
13
|
+
- `heading_line_length`: Number of characters for headings (`integer`, default
|
|
14
|
+
`80`)
|
|
15
|
+
- `headings`: Include headings (`boolean`, default `true`)
|
|
16
|
+
- `line_length`: Number of characters (`integer`, default `80`)
|
|
17
|
+
- `stern`: Stern length checking (`boolean`, default `false`)
|
|
18
|
+
- `strict`: Strict length checking (`boolean`, default `false`)
|
|
19
|
+
- `tables`: Include tables (`boolean`, default `true`)
|
|
20
|
+
|
|
21
|
+
> If `headings` is not provided, `headers` (deprecated) will be used.
|
|
22
|
+
|
|
23
|
+
This rule is triggered when there are lines that are longer than the
|
|
24
|
+
configured `line_length` (default: 80 characters). To fix this, split the line
|
|
25
|
+
up into multiple lines. To set a different maximum length for headings, use
|
|
26
|
+
`heading_line_length`. To set a different maximum length for code blocks, use
|
|
27
|
+
`code_block_line_length`
|
|
28
|
+
|
|
29
|
+
This rule has an exception when there is no whitespace beyond the configured
|
|
30
|
+
line length. This allows you to include items such as long URLs without being
|
|
31
|
+
forced to break them in the middle. To disable this exception, set the `strict`
|
|
32
|
+
parameter to `true` and an issue will be reported when any line is too long. To
|
|
33
|
+
warn for lines that are too long and could be fixed but allow long lines
|
|
34
|
+
without spaces, set the `stern` parameter to `true`.
|
|
35
|
+
|
|
36
|
+
For example (assuming normal behavior):
|
|
37
|
+
|
|
38
|
+
```markdown
|
|
39
|
+
IF THIS LINE IS THE MAXIMUM LENGTH
|
|
40
|
+
This line is okay because there are-no-spaces-beyond-that-length
|
|
41
|
+
And this line is a violation because there are
|
|
42
|
+
This-line-is-also-okay-because-there-are-no-spaces
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
In `strict` or `stern` modes, the two middle lines above are a violation. The
|
|
46
|
+
third line is a violation in `strict` mode but allowed in `stern` mode.
|
|
47
|
+
|
|
48
|
+
You have the option to exclude this rule for code blocks, tables, or headings.
|
|
49
|
+
To do so, set the `code_blocks`, `tables`, or `headings` parameter(s) to false.
|
|
50
|
+
|
|
51
|
+
Code blocks are included in this rule by default since it is often a
|
|
52
|
+
requirement for document readability, and tentatively compatible with code
|
|
53
|
+
rules. Still, some languages do not lend themselves to short lines.
|
|
54
|
+
|
|
55
|
+
Lines with link/image reference definitions are always exempted from this rule
|
|
56
|
+
(even in `strict` mode) because there is generally no way to split such lines
|
|
57
|
+
without breaking the URL.
|
|
58
|
+
|
|
59
|
+
Rationale: Extremely long lines can be difficult to work with in some editors.
|
|
60
|
+
More information: <https://cirosantilli.com/markdown-style-guide#line-wrapping>.
|
package/doc/md014.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# `MD014` - Dollar signs used before commands without showing output
|
|
2
|
+
|
|
3
|
+
Tags: `code`
|
|
4
|
+
|
|
5
|
+
Aliases: `commands-show-output`
|
|
6
|
+
|
|
7
|
+
Fixable: Some violations can be fixed by tooling
|
|
8
|
+
|
|
9
|
+
This rule is triggered when there are code blocks showing shell commands to be
|
|
10
|
+
typed, and *all* of the shell commands are preceded by dollar signs ($):
|
|
11
|
+
|
|
12
|
+
<!-- markdownlint-disable commands-show-output -->
|
|
13
|
+
|
|
14
|
+
```markdown
|
|
15
|
+
$ ls
|
|
16
|
+
$ cat foo
|
|
17
|
+
$ less bar
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
<!-- markdownlint-restore -->
|
|
21
|
+
|
|
22
|
+
The dollar signs are unnecessary in this situation, and should not be
|
|
23
|
+
included:
|
|
24
|
+
|
|
25
|
+
```markdown
|
|
26
|
+
ls
|
|
27
|
+
cat foo
|
|
28
|
+
less bar
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Showing output for commands preceded by dollar signs does not trigger this rule:
|
|
32
|
+
|
|
33
|
+
```markdown
|
|
34
|
+
$ ls
|
|
35
|
+
foo bar
|
|
36
|
+
$ cat foo
|
|
37
|
+
Hello world
|
|
38
|
+
$ cat bar
|
|
39
|
+
baz
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Because some commands do not produce output, it is not a violation if *some*
|
|
43
|
+
commands do not have output:
|
|
44
|
+
|
|
45
|
+
```markdown
|
|
46
|
+
$ mkdir test
|
|
47
|
+
mkdir: created directory 'test'
|
|
48
|
+
$ ls test
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Rationale: It is easier to copy/paste and less noisy if the dollar signs
|
|
52
|
+
are omitted when they are not needed. See
|
|
53
|
+
<https://cirosantilli.com/markdown-style-guide#dollar-signs-in-shell-code>
|
|
54
|
+
for more information.
|
package/doc/md018.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# `MD018` - No space after hash on atx style heading
|
|
2
|
+
|
|
3
|
+
Tags: `atx`, `headers`, `headings`, `spaces`
|
|
4
|
+
|
|
5
|
+
Aliases: `no-missing-space-atx`
|
|
6
|
+
|
|
7
|
+
Fixable: Some violations can be fixed by tooling
|
|
8
|
+
|
|
9
|
+
This rule is triggered when spaces are missing after the hash characters
|
|
10
|
+
in an atx style heading:
|
|
11
|
+
|
|
12
|
+
```markdown
|
|
13
|
+
#Heading 1
|
|
14
|
+
|
|
15
|
+
##Heading 2
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
To fix this, separate the heading text from the hash character by a single
|
|
19
|
+
space:
|
|
20
|
+
|
|
21
|
+
```markdown
|
|
22
|
+
# Heading 1
|
|
23
|
+
|
|
24
|
+
## Heading 2
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Rationale: Violations of this rule can lead to improperly rendered content.
|
package/doc/md019.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# `MD019` - Multiple spaces after hash on atx style heading
|
|
2
|
+
|
|
3
|
+
Tags: `atx`, `headers`, `headings`, `spaces`
|
|
4
|
+
|
|
5
|
+
Aliases: `no-multiple-space-atx`
|
|
6
|
+
|
|
7
|
+
Fixable: Some violations can be fixed by tooling
|
|
8
|
+
|
|
9
|
+
This rule is triggered when more than one space is used to separate the
|
|
10
|
+
heading text from the hash characters in an atx style heading:
|
|
11
|
+
|
|
12
|
+
```markdown
|
|
13
|
+
# Heading 1
|
|
14
|
+
|
|
15
|
+
## Heading 2
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
To fix this, separate the heading text from the hash character by a single
|
|
19
|
+
space:
|
|
20
|
+
|
|
21
|
+
```markdown
|
|
22
|
+
# Heading 1
|
|
23
|
+
|
|
24
|
+
## Heading 2
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Rationale: Extra space has no purpose and does not affect the rendering of
|
|
28
|
+
content.
|