markdownlint 0.26.2 → 0.27.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/CONTRIBUTING.md +81 -59
- package/README.md +424 -303
- package/demo/markdownlint-browser.js +374 -144
- package/doc/CustomRules.md +101 -50
- package/doc/Prettier.md +14 -10
- package/doc/ReleaseProcess.md +20 -0
- package/doc/Rules.md +453 -296
- 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 +44 -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/README.md +35 -15
- package/helpers/helpers.js +204 -42
- package/helpers/package.json +2 -2
- package/lib/constants.js +8 -1
- package/lib/markdownlint.js +7 -7
- 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/md033.js +15 -4
- package/lib/md034.js +70 -45
- package/lib/md035.js +1 -1
- package/lib/md037.js +2 -2
- package/lib/md038.js +1 -1
- package/lib/md039.js +1 -1
- package/lib/md040.js +21 -2
- package/lib/md043.js +4 -2
- package/lib/md044.js +4 -3
- package/lib/md051.js +37 -5
- package/lib/rules.js +1 -1
- package/package.json +31 -21
- package/schema/.markdownlint.jsonc +10 -3
- package/schema/.markdownlint.yaml +8 -2
- package/schema/markdownlint-config-schema.json +27 -3
- package/style/prettier.json +26 -0
package/doc/md020.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# `MD020` - No space inside hashes on closed atx style heading
|
|
2
|
+
|
|
3
|
+
Tags: `atx_closed`, `headers`, `headings`, `spaces`
|
|
4
|
+
|
|
5
|
+
Aliases: `no-missing-space-closed-atx`
|
|
6
|
+
|
|
7
|
+
Fixable: Some violations can be fixed by tooling
|
|
8
|
+
|
|
9
|
+
This rule is triggered when spaces are missing inside the hash characters
|
|
10
|
+
in a closed 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
|
+
Note: this rule will fire if either side of the heading is missing spaces.
|
|
28
|
+
|
|
29
|
+
Rationale: Violations of this rule can lead to improperly rendered content.
|
package/doc/md021.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# `MD021` - Multiple spaces inside hashes on closed atx style heading
|
|
2
|
+
|
|
3
|
+
Tags: `atx_closed`, `headers`, `headings`, `spaces`
|
|
4
|
+
|
|
5
|
+
Aliases: `no-multiple-space-closed-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 a closed 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
|
+
Note: this rule will fire if either side of the heading contains multiple
|
|
28
|
+
spaces.
|
|
29
|
+
|
|
30
|
+
Rationale: Extra space has no purpose and does not affect the rendering of
|
|
31
|
+
content.
|
package/doc/md022.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# `MD022` - Headings should be surrounded by blank lines
|
|
2
|
+
|
|
3
|
+
Tags: `blank_lines`, `headers`, `headings`
|
|
4
|
+
|
|
5
|
+
Aliases: `blanks-around-headers`, `blanks-around-headings`
|
|
6
|
+
|
|
7
|
+
Parameters:
|
|
8
|
+
|
|
9
|
+
- `lines_above`: Blank lines above heading (`integer`, default `1`)
|
|
10
|
+
- `lines_below`: Blank lines below heading (`integer`, default `1`)
|
|
11
|
+
|
|
12
|
+
Fixable: Some violations can be fixed by tooling
|
|
13
|
+
|
|
14
|
+
This rule is triggered when headings (any style) are either not preceded or not
|
|
15
|
+
followed by at least one blank line:
|
|
16
|
+
|
|
17
|
+
```markdown
|
|
18
|
+
# Heading 1
|
|
19
|
+
Some text
|
|
20
|
+
|
|
21
|
+
Some more text
|
|
22
|
+
## Heading 2
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
To fix this, ensure that all headings have a blank line both before and after
|
|
26
|
+
(except where the heading is at the beginning or end of the document):
|
|
27
|
+
|
|
28
|
+
```markdown
|
|
29
|
+
# Heading 1
|
|
30
|
+
|
|
31
|
+
Some text
|
|
32
|
+
|
|
33
|
+
Some more text
|
|
34
|
+
|
|
35
|
+
## Heading 2
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The `lines_above` and `lines_below` parameters can be used to specify a
|
|
39
|
+
different number of blank lines (including 0) above or below each heading.
|
|
40
|
+
|
|
41
|
+
Note: If `lines_above` or `lines_below` are configured to require more than one
|
|
42
|
+
blank line, [MD012/no-multiple-blanks](md012.md) should also be customized.
|
|
43
|
+
|
|
44
|
+
Rationale: Aside from aesthetic reasons, some parsers, including `kramdown`,
|
|
45
|
+
will not parse headings that don't have a blank line before, and will parse them
|
|
46
|
+
as regular text.
|
package/doc/md023.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# `MD023` - Headings must start at the beginning of the line
|
|
2
|
+
|
|
3
|
+
Tags: `headers`, `headings`, `spaces`
|
|
4
|
+
|
|
5
|
+
Aliases: `header-start-left`, `heading-start-left`
|
|
6
|
+
|
|
7
|
+
Fixable: Some violations can be fixed by tooling
|
|
8
|
+
|
|
9
|
+
This rule is triggered when a heading is indented by one or more spaces:
|
|
10
|
+
|
|
11
|
+
```markdown
|
|
12
|
+
Some text
|
|
13
|
+
|
|
14
|
+
# Indented heading
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
To fix this, ensure that all headings start at the beginning of the line:
|
|
18
|
+
|
|
19
|
+
```markdown
|
|
20
|
+
Some text
|
|
21
|
+
|
|
22
|
+
# Heading
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Rationale: Headings that don't start at the beginning of the line will not be
|
|
26
|
+
parsed as headings, and will instead appear as regular text.
|
package/doc/md024.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# `MD024` - Multiple headings with the same content
|
|
2
|
+
|
|
3
|
+
Tags: `headers`, `headings`
|
|
4
|
+
|
|
5
|
+
Aliases: `no-duplicate-header`, `no-duplicate-heading`
|
|
6
|
+
|
|
7
|
+
Parameters:
|
|
8
|
+
|
|
9
|
+
- `allow_different_nesting`: Only check sibling headings (`boolean`, default
|
|
10
|
+
`false`)
|
|
11
|
+
- `siblings_only`: Only check sibling headings (`boolean`, default `false`)
|
|
12
|
+
|
|
13
|
+
This rule is triggered if there are multiple headings in the document that have
|
|
14
|
+
the same text:
|
|
15
|
+
|
|
16
|
+
```markdown
|
|
17
|
+
# Some text
|
|
18
|
+
|
|
19
|
+
## Some text
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
To fix this, ensure that the content of each heading is different:
|
|
23
|
+
|
|
24
|
+
```markdown
|
|
25
|
+
# Some text
|
|
26
|
+
|
|
27
|
+
## Some more text
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
If the parameter `siblings_only` (alternatively `allow_different_nesting`) is
|
|
31
|
+
set to `true`, heading duplication is allowed for non-sibling headings (common
|
|
32
|
+
in changelogs):
|
|
33
|
+
|
|
34
|
+
```markdown
|
|
35
|
+
# Change log
|
|
36
|
+
|
|
37
|
+
## 1.0.0
|
|
38
|
+
|
|
39
|
+
### Features
|
|
40
|
+
|
|
41
|
+
## 2.0.0
|
|
42
|
+
|
|
43
|
+
### Features
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Rationale: Some Markdown parsers generate anchors for headings based on the
|
|
47
|
+
heading name; headings with the same content can cause problems with that.
|
package/doc/md025.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# `MD025` - Multiple top-level headings in the same document
|
|
2
|
+
|
|
3
|
+
Tags: `headers`, `headings`
|
|
4
|
+
|
|
5
|
+
Aliases: `single-h1`, `single-title`
|
|
6
|
+
|
|
7
|
+
Parameters:
|
|
8
|
+
|
|
9
|
+
- `front_matter_title`: RegExp for matching title in front matter (`string`,
|
|
10
|
+
default `^\s*title\s*[:=]`)
|
|
11
|
+
- `level`: Heading level (`integer`, default `1`)
|
|
12
|
+
|
|
13
|
+
This rule is triggered when a top-level heading is in use (the first line of
|
|
14
|
+
the file is an h1 heading), and more than one h1 heading is in use in the
|
|
15
|
+
document:
|
|
16
|
+
|
|
17
|
+
```markdown
|
|
18
|
+
# Top level heading
|
|
19
|
+
|
|
20
|
+
# Another top-level heading
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
To fix, structure your document so there is a single h1 heading that is
|
|
24
|
+
the title for the document. Subsequent headings must be
|
|
25
|
+
lower-level headings (h2, h3, etc.):
|
|
26
|
+
|
|
27
|
+
```markdown
|
|
28
|
+
# Title
|
|
29
|
+
|
|
30
|
+
## Heading
|
|
31
|
+
|
|
32
|
+
## Another heading
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Note: The `level` parameter can be used to change the top-level (ex: to h2) in
|
|
36
|
+
cases where an h1 is added externally.
|
|
37
|
+
|
|
38
|
+
If [YAML](https://en.wikipedia.org/wiki/YAML) front matter is present and
|
|
39
|
+
contains a `title` property (commonly used with blog posts), this rule treats
|
|
40
|
+
that as a top level heading and will report a violation for any subsequent
|
|
41
|
+
top-level headings. To use a different property name in the front matter,
|
|
42
|
+
specify the text of a regular expression via the `front_matter_title` parameter.
|
|
43
|
+
To disable the use of front matter by this rule, specify `""` for
|
|
44
|
+
`front_matter_title`.
|
|
45
|
+
|
|
46
|
+
Rationale: A top-level heading is an h1 on the first line of the file, and
|
|
47
|
+
serves as the title for the document. If this convention is in use, then there
|
|
48
|
+
can not be more than one title for the document, and the entire document should
|
|
49
|
+
be contained within this heading.
|
package/doc/md026.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# `MD026` - Trailing punctuation in heading
|
|
2
|
+
|
|
3
|
+
Tags: `headers`, `headings`
|
|
4
|
+
|
|
5
|
+
Aliases: `no-trailing-punctuation`
|
|
6
|
+
|
|
7
|
+
Parameters:
|
|
8
|
+
|
|
9
|
+
- `punctuation`: Punctuation characters not allowed at end of headings
|
|
10
|
+
(`string`, default `.,;:!。,;:!`)
|
|
11
|
+
|
|
12
|
+
Fixable: Some violations can be fixed by tooling
|
|
13
|
+
|
|
14
|
+
This rule is triggered on any heading that has one of the specified normal or
|
|
15
|
+
full-width punctuation characters as the last character in the line:
|
|
16
|
+
|
|
17
|
+
```markdown
|
|
18
|
+
# This is a heading.
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
To fix this, remove the trailing punctuation:
|
|
22
|
+
|
|
23
|
+
```markdown
|
|
24
|
+
# This is a heading
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Note: The `punctuation` parameter can be used to specify what characters count
|
|
28
|
+
as punctuation at the end of a heading. For example, you can change it to
|
|
29
|
+
`".,;:"` to allow headings that end with an exclamation point. `?` is
|
|
30
|
+
allowed by default because of how common it is in headings of FAQ-style
|
|
31
|
+
documents. Setting the `punctuation` parameter to `""` allows all characters -
|
|
32
|
+
and is equivalent to disabling the rule.
|
|
33
|
+
|
|
34
|
+
Note: The trailing semicolon of [HTML entity references][html-entity-references]
|
|
35
|
+
like `©`, `©`, and `©` is ignored by this rule.
|
|
36
|
+
|
|
37
|
+
Rationale: Headings are not meant to be full sentences. More information:
|
|
38
|
+
[Punctuation at the end of headers][end-punctuation].
|
|
39
|
+
|
|
40
|
+
[end-punctuation]: https://cirosantilli.com/markdown-style-guide#punctuation-at-the-end-of-headers
|
|
41
|
+
[html-entity-references]: https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references
|
package/doc/md027.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# `MD027` - Multiple spaces after blockquote symbol
|
|
2
|
+
|
|
3
|
+
Tags: `blockquote`, `indentation`, `whitespace`
|
|
4
|
+
|
|
5
|
+
Aliases: `no-multiple-space-blockquote`
|
|
6
|
+
|
|
7
|
+
Fixable: Some violations can be fixed by tooling
|
|
8
|
+
|
|
9
|
+
This rule is triggered when blockquotes have more than one space after the
|
|
10
|
+
blockquote (`>`) symbol:
|
|
11
|
+
|
|
12
|
+
```markdown
|
|
13
|
+
> This is a blockquote with bad indentation
|
|
14
|
+
> there should only be one.
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
To fix, remove any extraneous space:
|
|
18
|
+
|
|
19
|
+
```markdown
|
|
20
|
+
> This is a blockquote with correct
|
|
21
|
+
> indentation.
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Rationale: Consistent formatting makes it easier to understand a document.
|
package/doc/md028.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# `MD028` - Blank line inside blockquote
|
|
2
|
+
|
|
3
|
+
Tags: `blockquote`, `whitespace`
|
|
4
|
+
|
|
5
|
+
Aliases: `no-blanks-blockquote`
|
|
6
|
+
|
|
7
|
+
This rule is triggered when two blockquote blocks are separated by nothing
|
|
8
|
+
except for a blank line:
|
|
9
|
+
|
|
10
|
+
```markdown
|
|
11
|
+
> This is a blockquote
|
|
12
|
+
> which is immediately followed by
|
|
13
|
+
|
|
14
|
+
> this blockquote. Unfortunately
|
|
15
|
+
> In some parsers, these are treated as the same blockquote.
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
To fix this, ensure that any blockquotes that are right next to each other
|
|
19
|
+
have some text in between:
|
|
20
|
+
|
|
21
|
+
```markdown
|
|
22
|
+
> This is a blockquote.
|
|
23
|
+
|
|
24
|
+
And Jimmy also said:
|
|
25
|
+
|
|
26
|
+
> This too is a blockquote.
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Alternatively, if they are supposed to be the same quote, then add the
|
|
30
|
+
blockquote symbol at the beginning of the blank line:
|
|
31
|
+
|
|
32
|
+
```markdown
|
|
33
|
+
> This is a blockquote.
|
|
34
|
+
>
|
|
35
|
+
> This is the same blockquote.
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Rationale: Some Markdown parsers will treat two blockquotes separated by one
|
|
39
|
+
or more blank lines as the same blockquote, while others will treat them as
|
|
40
|
+
separate blockquotes.
|
package/doc/md029.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# `MD029` - Ordered list item prefix
|
|
2
|
+
|
|
3
|
+
Tags: `ol`
|
|
4
|
+
|
|
5
|
+
Aliases: `ol-prefix`
|
|
6
|
+
|
|
7
|
+
Parameters:
|
|
8
|
+
|
|
9
|
+
- `style`: List style (`string`, default `one_or_ordered`, values `one` /
|
|
10
|
+
`one_or_ordered` / `ordered` / `zero`)
|
|
11
|
+
|
|
12
|
+
This rule is triggered for ordered lists that do not either start with '1.' or
|
|
13
|
+
do not have a prefix that increases in numerical order (depending on the
|
|
14
|
+
configured style). The less-common pattern of using '0.' as a first prefix or
|
|
15
|
+
for all prefixes is also supported.
|
|
16
|
+
|
|
17
|
+
Example valid list if the style is configured as 'one':
|
|
18
|
+
|
|
19
|
+
```markdown
|
|
20
|
+
1. Do this.
|
|
21
|
+
1. Do that.
|
|
22
|
+
1. Done.
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Examples of valid lists if the style is configured as 'ordered':
|
|
26
|
+
|
|
27
|
+
```markdown
|
|
28
|
+
1. Do this.
|
|
29
|
+
2. Do that.
|
|
30
|
+
3. Done.
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```markdown
|
|
34
|
+
0. Do this.
|
|
35
|
+
1. Do that.
|
|
36
|
+
2. Done.
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
All three examples are valid when the style is configured as 'one_or_ordered'.
|
|
40
|
+
|
|
41
|
+
Example valid list if the style is configured as 'zero':
|
|
42
|
+
|
|
43
|
+
```markdown
|
|
44
|
+
0. Do this.
|
|
45
|
+
0. Do that.
|
|
46
|
+
0. Done.
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Example invalid list for all styles:
|
|
50
|
+
|
|
51
|
+
```markdown
|
|
52
|
+
1. Do this.
|
|
53
|
+
3. Done.
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
This rule supports 0-prefixing ordered list items for uniform indentation:
|
|
57
|
+
|
|
58
|
+
```markdown
|
|
59
|
+
...
|
|
60
|
+
08. Item
|
|
61
|
+
09. Item
|
|
62
|
+
10. Item
|
|
63
|
+
11. Item
|
|
64
|
+
...
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Note: This rule will report violations for cases like the following where an
|
|
68
|
+
improperly-indented code block (or similar) appears between two list items and
|
|
69
|
+
"breaks" the list in two:
|
|
70
|
+
|
|
71
|
+
<!-- markdownlint-disable code-fence-style -->
|
|
72
|
+
|
|
73
|
+
~~~markdown
|
|
74
|
+
1. First list
|
|
75
|
+
|
|
76
|
+
```text
|
|
77
|
+
Code block
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
1. Second list
|
|
81
|
+
~~~
|
|
82
|
+
|
|
83
|
+
The fix is to indent the code block so it becomes part of the preceding list
|
|
84
|
+
item as intended:
|
|
85
|
+
|
|
86
|
+
~~~markdown
|
|
87
|
+
1. First list
|
|
88
|
+
|
|
89
|
+
```text
|
|
90
|
+
Code block
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
2. Still first list
|
|
94
|
+
~~~
|
|
95
|
+
|
|
96
|
+
<!-- markdownlint-restore -->
|
|
97
|
+
|
|
98
|
+
Rationale: Consistent formatting makes it easier to understand a document.
|
package/doc/md030.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# `MD030` - Spaces after list markers
|
|
2
|
+
|
|
3
|
+
Tags: `ol`, `ul`, `whitespace`
|
|
4
|
+
|
|
5
|
+
Aliases: `list-marker-space`
|
|
6
|
+
|
|
7
|
+
Parameters:
|
|
8
|
+
|
|
9
|
+
- `ol_multi`: Spaces for multi-line ordered list items (`integer`, default `1`)
|
|
10
|
+
- `ol_single`: Spaces for single-line ordered list items (`integer`, default
|
|
11
|
+
`1`)
|
|
12
|
+
- `ul_multi`: Spaces for multi-line unordered list items (`integer`, default
|
|
13
|
+
`1`)
|
|
14
|
+
- `ul_single`: Spaces for single-line unordered list items (`integer`, default
|
|
15
|
+
`1`)
|
|
16
|
+
|
|
17
|
+
Fixable: Some violations can be fixed by tooling
|
|
18
|
+
|
|
19
|
+
This rule checks for the number of spaces between a list marker (e.g. '`-`',
|
|
20
|
+
'`*`', '`+`' or '`1.`') and the text of the list item.
|
|
21
|
+
|
|
22
|
+
The number of spaces checked for depends on the document style in use, but the
|
|
23
|
+
default is 1 space after any list marker:
|
|
24
|
+
|
|
25
|
+
```markdown
|
|
26
|
+
* Foo
|
|
27
|
+
* Bar
|
|
28
|
+
* Baz
|
|
29
|
+
|
|
30
|
+
1. Foo
|
|
31
|
+
1. Bar
|
|
32
|
+
1. Baz
|
|
33
|
+
|
|
34
|
+
1. Foo
|
|
35
|
+
* Bar
|
|
36
|
+
1. Baz
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
A document style may change the number of spaces after unordered list items
|
|
40
|
+
and ordered list items independently, as well as based on whether the content
|
|
41
|
+
of every item in the list consists of a single paragraph or multiple
|
|
42
|
+
paragraphs (including sub-lists and code blocks).
|
|
43
|
+
|
|
44
|
+
For example, the style guide at
|
|
45
|
+
<https://cirosantilli.com/markdown-style-guide#spaces-after-list-marker>
|
|
46
|
+
specifies that 1 space after the list marker should be used if every item in
|
|
47
|
+
the list fits within a single paragraph, but to use 2 or 3 spaces (for ordered
|
|
48
|
+
and unordered lists respectively) if there are multiple paragraphs of content
|
|
49
|
+
inside the list:
|
|
50
|
+
|
|
51
|
+
```markdown
|
|
52
|
+
* Foo
|
|
53
|
+
* Bar
|
|
54
|
+
* Baz
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
vs.
|
|
58
|
+
|
|
59
|
+
```markdown
|
|
60
|
+
* Foo
|
|
61
|
+
|
|
62
|
+
Second paragraph
|
|
63
|
+
|
|
64
|
+
* Bar
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
or
|
|
68
|
+
|
|
69
|
+
```markdown
|
|
70
|
+
1. Foo
|
|
71
|
+
|
|
72
|
+
Second paragraph
|
|
73
|
+
|
|
74
|
+
1. Bar
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
To fix this, ensure the correct number of spaces are used after the list marker
|
|
78
|
+
for your selected document style.
|
|
79
|
+
|
|
80
|
+
Rationale: Violations of this rule can lead to improperly rendered content.
|
|
81
|
+
|
|
82
|
+
Note: See [Prettier.md](Prettier.md) for compatibility information.
|
package/doc/md031.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# `MD031` - Fenced code blocks should be surrounded by blank lines
|
|
2
|
+
|
|
3
|
+
Tags: `blank_lines`, `code`
|
|
4
|
+
|
|
5
|
+
Aliases: `blanks-around-fences`
|
|
6
|
+
|
|
7
|
+
Parameters:
|
|
8
|
+
|
|
9
|
+
- `list_items`: Include list items (`boolean`, default `true`)
|
|
10
|
+
|
|
11
|
+
Fixable: Some violations can be fixed by tooling
|
|
12
|
+
|
|
13
|
+
This rule is triggered when fenced code blocks are either not preceded or not
|
|
14
|
+
followed by a blank line:
|
|
15
|
+
|
|
16
|
+
````markdown
|
|
17
|
+
Some text
|
|
18
|
+
```
|
|
19
|
+
Code block
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
Another code block
|
|
24
|
+
```
|
|
25
|
+
Some more text
|
|
26
|
+
````
|
|
27
|
+
|
|
28
|
+
To fix this, ensure that all fenced code blocks have a blank line both before
|
|
29
|
+
and after (except where the block is at the beginning or end of the document):
|
|
30
|
+
|
|
31
|
+
````markdown
|
|
32
|
+
Some text
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
Code block
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
Another code block
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Some more text
|
|
43
|
+
````
|
|
44
|
+
|
|
45
|
+
Set the `list_items` parameter to `false` to disable this rule for list items.
|
|
46
|
+
Disabling this behavior for lists can be useful if it is necessary to create a
|
|
47
|
+
[tight](https://spec.commonmark.org/0.29/#tight) list containing a code fence.
|
|
48
|
+
|
|
49
|
+
Rationale: Aside from aesthetic reasons, some parsers, including kramdown, will
|
|
50
|
+
not parse fenced code blocks that don't have blank lines before and after them.
|
package/doc/md032.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# `MD032` - Lists should be surrounded by blank lines
|
|
2
|
+
|
|
3
|
+
Tags: `blank_lines`, `bullet`, `ol`, `ul`
|
|
4
|
+
|
|
5
|
+
Aliases: `blanks-around-lists`
|
|
6
|
+
|
|
7
|
+
Fixable: Some violations can be fixed by tooling
|
|
8
|
+
|
|
9
|
+
This rule is triggered when lists (of any kind) are either not preceded or not
|
|
10
|
+
followed by a blank line:
|
|
11
|
+
|
|
12
|
+
```markdown
|
|
13
|
+
Some text
|
|
14
|
+
* Some
|
|
15
|
+
* List
|
|
16
|
+
|
|
17
|
+
1. Some
|
|
18
|
+
2. List
|
|
19
|
+
Some text
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
To fix this, ensure that all lists have a blank line both before and after
|
|
23
|
+
(except where the block is at the beginning or end of the document):
|
|
24
|
+
|
|
25
|
+
```markdown
|
|
26
|
+
Some text
|
|
27
|
+
|
|
28
|
+
* Some
|
|
29
|
+
* List
|
|
30
|
+
|
|
31
|
+
1. Some
|
|
32
|
+
2. List
|
|
33
|
+
|
|
34
|
+
Some text
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Rationale: Aside from aesthetic reasons, some parsers, including kramdown, will
|
|
38
|
+
not parse lists that don't have blank lines before and after them.
|
package/doc/md033.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# `MD033` - Inline HTML
|
|
2
|
+
|
|
3
|
+
Tags: `html`
|
|
4
|
+
|
|
5
|
+
Aliases: `no-inline-html`
|
|
6
|
+
|
|
7
|
+
Parameters:
|
|
8
|
+
|
|
9
|
+
- `allowed_elements`: Allowed elements (`string[]`, default `[]`)
|
|
10
|
+
|
|
11
|
+
This rule is triggered whenever raw HTML is used in a Markdown document:
|
|
12
|
+
|
|
13
|
+
```markdown
|
|
14
|
+
<h1>Inline HTML heading</h1>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
To fix this, use 'pure' Markdown instead of including raw HTML:
|
|
18
|
+
|
|
19
|
+
```markdown
|
|
20
|
+
# Markdown heading
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Note: To allow specific HTML elements, use the `allowed_elements` parameter.
|
|
24
|
+
|
|
25
|
+
Rationale: Raw HTML is allowed in Markdown, but this rule is included for
|
|
26
|
+
those who want their documents to only include "pure" Markdown, or for those
|
|
27
|
+
who are rendering Markdown documents into something other than HTML.
|
package/doc/md034.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# `MD034` - Bare URL used
|
|
2
|
+
|
|
3
|
+
Tags: `links`, `url`
|
|
4
|
+
|
|
5
|
+
Aliases: `no-bare-urls`
|
|
6
|
+
|
|
7
|
+
Fixable: Some violations can be fixed by tooling
|
|
8
|
+
|
|
9
|
+
This rule is triggered whenever a URL is given that isn't surrounded by angle
|
|
10
|
+
brackets:
|
|
11
|
+
|
|
12
|
+
```markdown
|
|
13
|
+
For more information, see https://www.example.com/.
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
To fix this, add angle brackets around the URL:
|
|
17
|
+
|
|
18
|
+
```markdown
|
|
19
|
+
For more information, see <https://www.example.com/>.
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Note: To use a bare URL without it being converted into a link, enclose it in
|
|
23
|
+
a code block, otherwise in some Markdown parsers it *will* be converted:
|
|
24
|
+
|
|
25
|
+
```markdown
|
|
26
|
+
`https://www.example.com`
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Note: The following scenario does *not* trigger this rule to avoid conflicts
|
|
30
|
+
with `MD011`/`no-reversed-links`:
|
|
31
|
+
|
|
32
|
+
```markdown
|
|
33
|
+
[https://www.example.com]
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The use of quotes around a bare link will *not* trigger this rule, either:
|
|
37
|
+
|
|
38
|
+
```markdown
|
|
39
|
+
"https://www.example.com"
|
|
40
|
+
'https://www.example.com'
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Rationale: Without angle brackets, the URL isn't converted into a link by many
|
|
44
|
+
Markdown parsers.
|