markdownlint 0.29.0 → 0.31.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 +13 -0
- package/demo/markdownlint-browser.js +997 -891
- package/doc/CustomRules.md +2 -0
- package/doc/Rules.md +46 -23
- package/doc/md022.md +12 -6
- package/doc/md026.md +1 -2
- package/doc/md049.md +2 -2
- package/doc/md050.md +2 -2
- package/doc/md051.md +17 -6
- package/doc/md052.md +13 -6
- package/helpers/helpers.js +146 -235
- package/helpers/micromark.cjs +192 -53
- package/helpers/package.json +2 -2
- package/helpers/shared.js +7 -0
- package/lib/cache.js +0 -2
- package/lib/constants.js +1 -1
- package/lib/markdownlint.d.ts +10 -2
- package/lib/markdownlint.js +37 -13
- package/lib/md022.js +80 -40
- package/lib/md026.js +19 -12
- package/lib/md032.js +62 -31
- package/lib/md033.js +20 -45
- package/lib/md037.js +70 -164
- package/lib/md043.js +42 -40
- package/lib/md044.js +15 -41
- package/lib/md045.js +17 -5
- package/lib/md049-md050.js +6 -3
- package/lib/md051.js +123 -72
- package/lib/md052.js +7 -3
- package/package.json +25 -24
- package/schema/.markdownlint.jsonc +7 -4
- package/schema/.markdownlint.yaml +6 -4
- package/schema/markdownlint-config-schema.json +32 -9
package/doc/CustomRules.md
CHANGED
|
@@ -82,6 +82,8 @@ properties:
|
|
|
82
82
|
error.
|
|
83
83
|
- `context` is an optional `String` with relevant text surrounding the error
|
|
84
84
|
location.
|
|
85
|
+
- `information` is an optional (absolute) `URL` of a link to override the
|
|
86
|
+
same-named value provided by the rule definition. (Uncommon)
|
|
85
87
|
- `range` is an optional `Array` with two `Number` values identifying the
|
|
86
88
|
1-based column and length of the error.
|
|
87
89
|
- `fixInfo` is an optional `Object` with information about how to fix the
|
package/doc/Rules.md
CHANGED
|
@@ -806,8 +806,8 @@ Aliases: `blanks-around-headers`, `blanks-around-headings`
|
|
|
806
806
|
|
|
807
807
|
Parameters:
|
|
808
808
|
|
|
809
|
-
- `lines_above`: Blank lines above heading (`integer`, default `1`)
|
|
810
|
-
- `lines_below`: Blank lines below heading (`integer`, default `1`)
|
|
809
|
+
- `lines_above`: Blank lines above heading (`integer|integer[]`, default `1`)
|
|
810
|
+
- `lines_below`: Blank lines below heading (`integer|integer[]`, default `1`)
|
|
811
811
|
|
|
812
812
|
Fixable: Some violations can be fixed by tooling
|
|
813
813
|
|
|
@@ -836,10 +836,16 @@ Some more text
|
|
|
836
836
|
```
|
|
837
837
|
|
|
838
838
|
The `lines_above` and `lines_below` parameters can be used to specify a
|
|
839
|
-
different number of blank lines (including 0) above or below each heading.
|
|
839
|
+
different number of blank lines (including `0`) above or below each heading.
|
|
840
|
+
If the value `-1` is used for either parameter, any number of blank lines is
|
|
841
|
+
allowed. To customize the number of lines above or below each heading level
|
|
842
|
+
individually, specify a `number[]` where values correspond to heading levels
|
|
843
|
+
1-6 (in order).
|
|
840
844
|
|
|
841
|
-
|
|
842
|
-
blank line, [MD012/no-multiple-blanks](md012.md) should also be customized.
|
|
845
|
+
Notes: If `lines_above` or `lines_below` are configured to require more than one
|
|
846
|
+
blank line, [MD012/no-multiple-blanks](md012.md) should also be customized. This
|
|
847
|
+
rule checks for *at least* as many blank lines as specified; any extra blank
|
|
848
|
+
lines are ignored.
|
|
843
849
|
|
|
844
850
|
Rationale: Aside from aesthetic reasons, some parsers, including `kramdown`,
|
|
845
851
|
will not parse headings that don't have a blank line before, and will parse them
|
|
@@ -986,8 +992,7 @@ Aliases: `no-trailing-punctuation`
|
|
|
986
992
|
|
|
987
993
|
Parameters:
|
|
988
994
|
|
|
989
|
-
- `punctuation`: Punctuation characters
|
|
990
|
-
(`string`, default `.,;:!。,;:!`)
|
|
995
|
+
- `punctuation`: Punctuation characters (`string`, default `.,;:!。,;:!`)
|
|
991
996
|
|
|
992
997
|
Fixable: Some violations can be fixed by tooling
|
|
993
998
|
|
|
@@ -2079,8 +2084,8 @@ Aliases: `emphasis-style`
|
|
|
2079
2084
|
|
|
2080
2085
|
Parameters:
|
|
2081
2086
|
|
|
2082
|
-
- `style`: Emphasis style
|
|
2083
|
-
|
|
2087
|
+
- `style`: Emphasis style (`string`, default `consistent`, values `asterisk` /
|
|
2088
|
+
`consistent` / `underscore`)
|
|
2084
2089
|
|
|
2085
2090
|
Fixable: Some violations can be fixed by tooling
|
|
2086
2091
|
|
|
@@ -2114,8 +2119,8 @@ Aliases: `strong-style`
|
|
|
2114
2119
|
|
|
2115
2120
|
Parameters:
|
|
2116
2121
|
|
|
2117
|
-
- `style`: Strong style
|
|
2118
|
-
|
|
2122
|
+
- `style`: Strong style (`string`, default `consistent`, values `asterisk` /
|
|
2123
|
+
`consistent` / `underscore`)
|
|
2119
2124
|
|
|
2120
2125
|
Fixable: Some violations can be fixed by tooling
|
|
2121
2126
|
|
|
@@ -2153,21 +2158,32 @@ This rule is triggered when a link fragment does not match any of the fragments
|
|
|
2153
2158
|
that are automatically generated for headings in a document:
|
|
2154
2159
|
|
|
2155
2160
|
```markdown
|
|
2156
|
-
#
|
|
2161
|
+
# Heading Name
|
|
2157
2162
|
|
|
2158
2163
|
[Link](#fragment)
|
|
2159
2164
|
```
|
|
2160
2165
|
|
|
2161
|
-
To fix this issue, change the link fragment to reference an existing heading
|
|
2166
|
+
To fix this issue, change the link fragment to reference an existing heading's
|
|
2167
|
+
generated name (see below):
|
|
2162
2168
|
|
|
2163
2169
|
```markdown
|
|
2164
|
-
#
|
|
2170
|
+
# Heading Name
|
|
2171
|
+
|
|
2172
|
+
[Link](#heading-name)
|
|
2173
|
+
```
|
|
2174
|
+
|
|
2175
|
+
Alternatively, some platforms allow the syntax `{#named-anchor}` to be used
|
|
2176
|
+
within a heading to provide a specific name (consisting of only lower-case
|
|
2177
|
+
letters, numbers, `-`, and `_`):
|
|
2165
2178
|
|
|
2166
|
-
|
|
2179
|
+
```markdown
|
|
2180
|
+
# Heading Name {#custom-name}
|
|
2181
|
+
|
|
2182
|
+
[Link](#custom-name)
|
|
2167
2183
|
```
|
|
2168
2184
|
|
|
2169
|
-
Alternatively,
|
|
2170
|
-
define a fragment:
|
|
2185
|
+
Alternatively, any HTML tag with an `id` attribute or an `a` tag with a `name`
|
|
2186
|
+
attribute can be used to define a fragment:
|
|
2171
2187
|
|
|
2172
2188
|
```markdown
|
|
2173
2189
|
<a id="bookmark"></a>
|
|
@@ -2200,6 +2216,10 @@ Tags: `images`, `links`
|
|
|
2200
2216
|
|
|
2201
2217
|
Aliases: `reference-links-images`
|
|
2202
2218
|
|
|
2219
|
+
Parameters:
|
|
2220
|
+
|
|
2221
|
+
- `shortcut_syntax`: Include shortcut syntax (`boolean`, default `false`)
|
|
2222
|
+
|
|
2203
2223
|
Links and images in Markdown can provide the link destination or image source
|
|
2204
2224
|
at the time of use or can define it elsewhere and use a label for reference.
|
|
2205
2225
|
The reference format is convenient for keeping paragraph text clutter-free
|
|
@@ -2220,13 +2240,16 @@ Shortcut: ![image]
|
|
|
2220
2240
|
[image]: https://example.com/image
|
|
2221
2241
|
```
|
|
2222
2242
|
|
|
2223
|
-
A link or image renders correctly when
|
|
2224
|
-
|
|
2225
|
-
of undefined labels for "full" and "collapsed" reference syntax
|
|
2243
|
+
A link or image renders correctly when the corresponding label is defined, but
|
|
2244
|
+
displays as text with brackets when the label is not present. By default, this
|
|
2245
|
+
rule warns of undefined labels for "full" and "collapsed" reference syntax but
|
|
2246
|
+
not for "shortcut" syntax because it is ambiguous.
|
|
2226
2247
|
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2248
|
+
The text `[example]` could be a shortcut link or the text "example" in brackets,
|
|
2249
|
+
so "shortcut" syntax is ignored by default. To include "shortcut" syntax, set
|
|
2250
|
+
the `include_shortcut` parameter to `true`. Note that doing so produces warnings
|
|
2251
|
+
for *all* text in the document that *could* be a shortcut. If bracketed text is
|
|
2252
|
+
intentional, brackets can be escaped with the `\` character: `\[example\]`.
|
|
2230
2253
|
|
|
2231
2254
|
<a name="md053"></a>
|
|
2232
2255
|
|
package/doc/md022.md
CHANGED
|
@@ -6,8 +6,8 @@ Aliases: `blanks-around-headers`, `blanks-around-headings`
|
|
|
6
6
|
|
|
7
7
|
Parameters:
|
|
8
8
|
|
|
9
|
-
- `lines_above`: Blank lines above heading (`integer`, default `1`)
|
|
10
|
-
- `lines_below`: Blank lines below heading (`integer`, default `1`)
|
|
9
|
+
- `lines_above`: Blank lines above heading (`integer|integer[]`, default `1`)
|
|
10
|
+
- `lines_below`: Blank lines below heading (`integer|integer[]`, default `1`)
|
|
11
11
|
|
|
12
12
|
Fixable: Some violations can be fixed by tooling
|
|
13
13
|
|
|
@@ -36,10 +36,16 @@ Some more text
|
|
|
36
36
|
```
|
|
37
37
|
|
|
38
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
|
-
|
|
42
|
-
|
|
39
|
+
different number of blank lines (including `0`) above or below each heading.
|
|
40
|
+
If the value `-1` is used for either parameter, any number of blank lines is
|
|
41
|
+
allowed. To customize the number of lines above or below each heading level
|
|
42
|
+
individually, specify a `number[]` where values correspond to heading levels
|
|
43
|
+
1-6 (in order).
|
|
44
|
+
|
|
45
|
+
Notes: If `lines_above` or `lines_below` are configured to require more than one
|
|
46
|
+
blank line, [MD012/no-multiple-blanks](md012.md) should also be customized. This
|
|
47
|
+
rule checks for *at least* as many blank lines as specified; any extra blank
|
|
48
|
+
lines are ignored.
|
|
43
49
|
|
|
44
50
|
Rationale: Aside from aesthetic reasons, some parsers, including `kramdown`,
|
|
45
51
|
will not parse headings that don't have a blank line before, and will parse them
|
package/doc/md026.md
CHANGED
|
@@ -6,8 +6,7 @@ Aliases: `no-trailing-punctuation`
|
|
|
6
6
|
|
|
7
7
|
Parameters:
|
|
8
8
|
|
|
9
|
-
- `punctuation`: Punctuation characters
|
|
10
|
-
(`string`, default `.,;:!。,;:!`)
|
|
9
|
+
- `punctuation`: Punctuation characters (`string`, default `.,;:!。,;:!`)
|
|
11
10
|
|
|
12
11
|
Fixable: Some violations can be fixed by tooling
|
|
13
12
|
|
package/doc/md049.md
CHANGED
|
@@ -6,8 +6,8 @@ Aliases: `emphasis-style`
|
|
|
6
6
|
|
|
7
7
|
Parameters:
|
|
8
8
|
|
|
9
|
-
- `style`: Emphasis style
|
|
10
|
-
|
|
9
|
+
- `style`: Emphasis style (`string`, default `consistent`, values `asterisk` /
|
|
10
|
+
`consistent` / `underscore`)
|
|
11
11
|
|
|
12
12
|
Fixable: Some violations can be fixed by tooling
|
|
13
13
|
|
package/doc/md050.md
CHANGED
|
@@ -6,8 +6,8 @@ Aliases: `strong-style`
|
|
|
6
6
|
|
|
7
7
|
Parameters:
|
|
8
8
|
|
|
9
|
-
- `style`: Strong style
|
|
10
|
-
|
|
9
|
+
- `style`: Strong style (`string`, default `consistent`, values `asterisk` /
|
|
10
|
+
`consistent` / `underscore`)
|
|
11
11
|
|
|
12
12
|
Fixable: Some violations can be fixed by tooling
|
|
13
13
|
|
package/doc/md051.md
CHANGED
|
@@ -10,21 +10,32 @@ This rule is triggered when a link fragment does not match any of the fragments
|
|
|
10
10
|
that are automatically generated for headings in a document:
|
|
11
11
|
|
|
12
12
|
```markdown
|
|
13
|
-
#
|
|
13
|
+
# Heading Name
|
|
14
14
|
|
|
15
15
|
[Link](#fragment)
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
To fix this issue, change the link fragment to reference an existing heading
|
|
18
|
+
To fix this issue, change the link fragment to reference an existing heading's
|
|
19
|
+
generated name (see below):
|
|
19
20
|
|
|
20
21
|
```markdown
|
|
21
|
-
#
|
|
22
|
+
# Heading Name
|
|
22
23
|
|
|
23
|
-
[Link](#
|
|
24
|
+
[Link](#heading-name)
|
|
24
25
|
```
|
|
25
26
|
|
|
26
|
-
Alternatively,
|
|
27
|
-
|
|
27
|
+
Alternatively, some platforms allow the syntax `{#named-anchor}` to be used
|
|
28
|
+
within a heading to provide a specific name (consisting of only lower-case
|
|
29
|
+
letters, numbers, `-`, and `_`):
|
|
30
|
+
|
|
31
|
+
```markdown
|
|
32
|
+
# Heading Name {#custom-name}
|
|
33
|
+
|
|
34
|
+
[Link](#custom-name)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Alternatively, any HTML tag with an `id` attribute or an `a` tag with a `name`
|
|
38
|
+
attribute can be used to define a fragment:
|
|
28
39
|
|
|
29
40
|
```markdown
|
|
30
41
|
<a id="bookmark"></a>
|
package/doc/md052.md
CHANGED
|
@@ -4,6 +4,10 @@ Tags: `images`, `links`
|
|
|
4
4
|
|
|
5
5
|
Aliases: `reference-links-images`
|
|
6
6
|
|
|
7
|
+
Parameters:
|
|
8
|
+
|
|
9
|
+
- `shortcut_syntax`: Include shortcut syntax (`boolean`, default `false`)
|
|
10
|
+
|
|
7
11
|
Links and images in Markdown can provide the link destination or image source
|
|
8
12
|
at the time of use or can define it elsewhere and use a label for reference.
|
|
9
13
|
The reference format is convenient for keeping paragraph text clutter-free
|
|
@@ -24,10 +28,13 @@ Shortcut: ![image]
|
|
|
24
28
|
[image]: https://example.com/image
|
|
25
29
|
```
|
|
26
30
|
|
|
27
|
-
A link or image renders correctly when
|
|
28
|
-
|
|
29
|
-
of undefined labels for "full" and "collapsed" reference syntax
|
|
31
|
+
A link or image renders correctly when the corresponding label is defined, but
|
|
32
|
+
displays as text with brackets when the label is not present. By default, this
|
|
33
|
+
rule warns of undefined labels for "full" and "collapsed" reference syntax but
|
|
34
|
+
not for "shortcut" syntax because it is ambiguous.
|
|
30
35
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
36
|
+
The text `[example]` could be a shortcut link or the text "example" in brackets,
|
|
37
|
+
so "shortcut" syntax is ignored by default. To include "shortcut" syntax, set
|
|
38
|
+
the `include_shortcut` parameter to `true`. Note that doing so produces warnings
|
|
39
|
+
for *all* text in the document that *could* be a shortcut. If bracketed text is
|
|
40
|
+
intentional, brackets can be escaped with the `\` character: `\[example\]`.
|