markdownlint 0.22.0 → 0.25.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 +13 -3
- package/LICENSE +1 -1
- package/README.md +140 -83
- package/demo/markdownlint-browser.js +1599 -3309
- package/doc/CustomRules.md +15 -4
- package/doc/Prettier.md +23 -0
- package/doc/Rules.md +191 -80
- package/helpers/LICENSE +1 -1
- package/helpers/helpers.js +260 -68
- package/helpers/package.json +1 -1
- package/lib/cache.js +14 -5
- package/lib/constants.js +7 -0
- package/lib/markdownlint.d.ts +31 -11
- package/lib/markdownlint.js +336 -254
- package/lib/md002.js +1 -1
- package/lib/md004.js +46 -13
- package/lib/md006.js +1 -1
- package/lib/md007.js +4 -2
- package/lib/md009.js +24 -20
- package/lib/md010.js +25 -16
- package/lib/md011.js +31 -27
- package/lib/md018.js +1 -1
- package/lib/md019.js +1 -1
- package/lib/md020.js +1 -1
- package/lib/md021.js +1 -1
- package/lib/md023.js +1 -1
- package/lib/md025.js +1 -1
- package/lib/md032.js +2 -2
- package/lib/md033.js +12 -8
- package/lib/md035.js +4 -4
- package/lib/md037.js +40 -12
- package/lib/md039.js +4 -3
- package/lib/md041.js +14 -3
- package/lib/md043.js +9 -5
- package/lib/md044.js +54 -71
- package/lib/md049.js +45 -0
- package/lib/md050.js +45 -0
- package/lib/rules.js +6 -5
- package/package.json +46 -37
- package/schema/.markdownlint.jsonc +266 -0
- package/schema/.markdownlint.yaml +239 -0
- package/schema/markdownlint-config-schema.json +129 -22
- package/schema/build-config-schema.js +0 -417
package/doc/Rules.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Rules
|
|
2
2
|
|
|
3
3
|
This document contains a description of all rules, what they are checking for,
|
|
4
|
-
as well as
|
|
4
|
+
as well as examples of documents that break the rule and corrected
|
|
5
5
|
versions of the examples. Any rule whose heading is ~~struck through~~ is
|
|
6
6
|
deprecated, but still provided for backward-compatibility.
|
|
7
7
|
|
|
@@ -47,7 +47,7 @@ when skipped - especially for accessibility scenarios. More information:
|
|
|
47
47
|
|
|
48
48
|
<a name="md002"></a>
|
|
49
49
|
|
|
50
|
-
## ~~MD002 - First heading should be a top
|
|
50
|
+
## ~~MD002 - First heading should be a top-level heading~~
|
|
51
51
|
|
|
52
52
|
Tags: headings, headers
|
|
53
53
|
|
|
@@ -59,26 +59,26 @@ Parameters: level (number; default 1)
|
|
|
59
59
|
> [MD041/first-line-heading](#md041) offers an improved implementation.
|
|
60
60
|
|
|
61
61
|
This rule is intended to ensure document headings start at the top level and
|
|
62
|
-
is triggered when the first heading in the document isn't
|
|
62
|
+
is triggered when the first heading in the document isn't an h1 heading:
|
|
63
63
|
|
|
64
64
|
```markdown
|
|
65
|
-
## This isn't
|
|
65
|
+
## This isn't an H1 heading
|
|
66
66
|
|
|
67
67
|
### Another heading
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
-
The first heading in the document should be
|
|
70
|
+
The first heading in the document should be an h1 heading:
|
|
71
71
|
|
|
72
72
|
```markdown
|
|
73
|
-
# Start with
|
|
73
|
+
# Start with an H1 heading
|
|
74
74
|
|
|
75
75
|
## Then use an H2 for subsections
|
|
76
76
|
```
|
|
77
77
|
|
|
78
|
-
Note: The `level` parameter can be used to change the top
|
|
79
|
-
cases where
|
|
78
|
+
Note: The `level` parameter can be used to change the top-level (ex: to h2) in
|
|
79
|
+
cases where an h1 is added externally.
|
|
80
80
|
|
|
81
|
-
Rationale: The top
|
|
81
|
+
Rationale: The top-level heading often acts as the title of a document. More
|
|
82
82
|
information: <https://cirosantilli.com/markdown-style-guide#top-level-header>.
|
|
83
83
|
|
|
84
84
|
<a name="md003"></a>
|
|
@@ -127,7 +127,7 @@ Setext style H2
|
|
|
127
127
|
|
|
128
128
|
Note: the configured heading style can be a specific style to use (atx,
|
|
129
129
|
atx_closed, setext, setext_with_atx, setext_with_atx_closed), or simply require
|
|
130
|
-
that the usage
|
|
130
|
+
that the usage is consistent within the document.
|
|
131
131
|
|
|
132
132
|
Rationale: Consistent formatting makes it easier to understand a document.
|
|
133
133
|
|
|
@@ -142,6 +142,8 @@ Aliases: ul-style
|
|
|
142
142
|
Parameters: style ("consistent", "asterisk", "plus", "dash", "sublist"; default
|
|
143
143
|
"consistent")
|
|
144
144
|
|
|
145
|
+
Fixable: Most violations can be fixed by tooling
|
|
146
|
+
|
|
145
147
|
This rule is triggered when the symbols used in the document for unordered
|
|
146
148
|
list items do not match the configured unordered list style:
|
|
147
149
|
|
|
@@ -161,11 +163,12 @@ document:
|
|
|
161
163
|
```
|
|
162
164
|
|
|
163
165
|
The configured list style can be a specific symbol to use (asterisk, plus, dash),
|
|
164
|
-
|
|
165
|
-
sublist
|
|
166
|
+
to ensure that all list styling is consistent, or to ensure that each
|
|
167
|
+
sublist has a consistent symbol that differs from its parent list.
|
|
166
168
|
|
|
167
169
|
For example, the following is valid for the `sublist` style because the outer-most
|
|
168
|
-
indent uses asterisk, the middle indent uses plus, and the inner-most indent uses
|
|
170
|
+
indent uses asterisk, the middle indent uses plus, and the inner-most indent uses
|
|
171
|
+
dash:
|
|
169
172
|
|
|
170
173
|
```markdown
|
|
171
174
|
* Item 1
|
|
@@ -198,7 +201,7 @@ but don't have the same indentation:
|
|
|
198
201
|
* A misaligned item
|
|
199
202
|
```
|
|
200
203
|
|
|
201
|
-
Usually this rule will be triggered because of a typo. Correct the indentation
|
|
204
|
+
Usually, this rule will be triggered because of a typo. Correct the indentation
|
|
202
205
|
for the list to fix it:
|
|
203
206
|
|
|
204
207
|
```markdown
|
|
@@ -244,7 +247,7 @@ Aliases: ul-start-left
|
|
|
244
247
|
|
|
245
248
|
Fixable: Most violations can be fixed by tooling
|
|
246
249
|
|
|
247
|
-
This rule is triggered when top
|
|
250
|
+
This rule is triggered when top-level lists don't start at the beginning of a
|
|
248
251
|
line:
|
|
249
252
|
|
|
250
253
|
```markdown
|
|
@@ -254,7 +257,7 @@ Some text
|
|
|
254
257
|
* List item
|
|
255
258
|
```
|
|
256
259
|
|
|
257
|
-
To fix, ensure that top
|
|
260
|
+
To fix, ensure that top-level list items are not indented:
|
|
258
261
|
|
|
259
262
|
```markdown
|
|
260
263
|
Some test
|
|
@@ -289,7 +292,11 @@ Tags: bullet, ul, indentation
|
|
|
289
292
|
|
|
290
293
|
Aliases: ul-indent
|
|
291
294
|
|
|
292
|
-
|
|
295
|
+
<!-- markdownlint-disable line-length -->
|
|
296
|
+
|
|
297
|
+
Parameters: indent, start_indented, start_indent (number; default 2, boolean; default false, number; defaults to indent)
|
|
298
|
+
|
|
299
|
+
<!-- markdownlint-restore -->
|
|
293
300
|
|
|
294
301
|
Fixable: Most violations can be fixed by tooling
|
|
295
302
|
|
|
@@ -316,16 +323,20 @@ rule).
|
|
|
316
323
|
|
|
317
324
|
The `start_indented` parameter allows the first level of lists to be indented by
|
|
318
325
|
the configured number of spaces rather than starting at zero (the inverse of
|
|
319
|
-
MD006).
|
|
326
|
+
MD006). The `start_indent` parameter allows the first level of lists to be indented
|
|
327
|
+
by a different number of spaces than the rest (ignored when `start_indented` is not
|
|
328
|
+
set).
|
|
320
329
|
|
|
321
330
|
Rationale: Indenting by 2 spaces allows the content of a nested list to be in
|
|
322
331
|
line with the start of the content of the parent list when a single space is
|
|
323
332
|
used after the list marker. Indenting by 4 spaces is consistent with code blocks
|
|
324
333
|
and simpler for editors to implement. Additionally, this can be a compatibility
|
|
325
|
-
issue for multi-markdown parsers, which require
|
|
334
|
+
issue for multi-markdown parsers, which require 4-space indents. More information:
|
|
326
335
|
<https://cirosantilli.com/markdown-style-guide#indentation-of-content-inside-lists>
|
|
327
336
|
and <http://support.markedapp.com/discussions/problems/21-sub-lists-not-indenting>.
|
|
328
337
|
|
|
338
|
+
Note: See [Prettier.md](Prettier.md) for compatibility information.
|
|
339
|
+
|
|
329
340
|
<a name="md009"></a>
|
|
330
341
|
|
|
331
342
|
## MD009 - Trailing spaces
|
|
@@ -334,8 +345,12 @@ Tags: whitespace
|
|
|
334
345
|
|
|
335
346
|
Aliases: no-trailing-spaces
|
|
336
347
|
|
|
348
|
+
<!-- markdownlint-disable line-length -->
|
|
349
|
+
|
|
337
350
|
Parameters: br_spaces, list_item_empty_lines, strict (number; default 2, boolean; default false, boolean; default false)
|
|
338
351
|
|
|
352
|
+
<!-- markdownlint-restore -->
|
|
353
|
+
|
|
339
354
|
Fixable: Most violations can be fixed by tooling
|
|
340
355
|
|
|
341
356
|
This rule is triggered on any lines that end with unexpected whitespace. To fix this,
|
|
@@ -381,7 +396,7 @@ Tags: whitespace, hard_tab
|
|
|
381
396
|
|
|
382
397
|
Aliases: no-hard-tabs
|
|
383
398
|
|
|
384
|
-
Parameters: code_blocks (boolean; default true)
|
|
399
|
+
Parameters: code_blocks, spaces_per_tab (boolean; default true, number; default 1)
|
|
385
400
|
|
|
386
401
|
Fixable: Most violations can be fixed by tooling
|
|
387
402
|
|
|
@@ -399,7 +414,7 @@ Some text
|
|
|
399
414
|
* hard tab character used to indent the list item
|
|
400
415
|
```
|
|
401
416
|
|
|
402
|
-
<!-- markdownlint-
|
|
417
|
+
<!-- markdownlint-restore -->
|
|
403
418
|
|
|
404
419
|
Corrected example:
|
|
405
420
|
|
|
@@ -409,9 +424,14 @@ Some text
|
|
|
409
424
|
* Spaces used to indent the list item instead
|
|
410
425
|
```
|
|
411
426
|
|
|
412
|
-
You have the option to exclude this rule for code blocks. To do so,
|
|
413
|
-
`code_blocks` parameter to `false`. Code blocks are included
|
|
414
|
-
handling of tabs by tools
|
|
427
|
+
You have the option to exclude this rule for code blocks and spans. To do so,
|
|
428
|
+
set the `code_blocks` parameter to `false`. Code blocks and spans are included
|
|
429
|
+
by default since handling of tabs by Markdown tools can be inconsistent (e.g.,
|
|
430
|
+
using 4 vs. 8 spaces).
|
|
431
|
+
|
|
432
|
+
By default, violations of this rule are fixed by replacing the tab with 1 space
|
|
433
|
+
character. To use a different number of spaces, set the `spaces_per_tab`
|
|
434
|
+
parameter to the desired value.
|
|
415
435
|
|
|
416
436
|
Rationale: Hard tabs are often rendered inconsistently by different editors and
|
|
417
437
|
can be harder to work with than spaces.
|
|
@@ -440,7 +460,8 @@ To fix this, swap the `[]` and `()` around:
|
|
|
440
460
|
[Correct link syntax](https://www.example.com/)
|
|
441
461
|
```
|
|
442
462
|
|
|
443
|
-
Note: [Markdown Extra](https://en.wikipedia.org/wiki/Markdown_Extra)-style
|
|
463
|
+
Note: [Markdown Extra](https://en.wikipedia.org/wiki/Markdown_Extra)-style
|
|
464
|
+
footnotes do not trigger this rule:
|
|
444
465
|
|
|
445
466
|
```markdown
|
|
446
467
|
For (example)[^1]
|
|
@@ -499,7 +520,7 @@ Aliases: line-length
|
|
|
499
520
|
|
|
500
521
|
Parameters: line_length, heading_line_length, code_block_line_length, code_blocks, tables, headings, headers, strict, stern (number; default 80 for *_length, boolean; default true (except strict/stern which default false))
|
|
501
522
|
|
|
502
|
-
<!-- markdownlint-
|
|
523
|
+
<!-- markdownlint-restore -->
|
|
503
524
|
|
|
504
525
|
> If `headings` is not provided, `headers` (deprecated) will be used.
|
|
505
526
|
|
|
@@ -526,7 +547,7 @@ This-line-is-also-okay-because-there-are-no-spaces
|
|
|
526
547
|
```
|
|
527
548
|
|
|
528
549
|
In `strict` or `stern` modes, the two middle lines above are a violation. The
|
|
529
|
-
third line is a violation in `strict` mode
|
|
550
|
+
third line is a violation in `strict` mode but allowed in `stern` mode.
|
|
530
551
|
|
|
531
552
|
You have the option to exclude this rule for code blocks, tables, or headings.
|
|
532
553
|
To do so, set the `code_blocks`, `tables`, or `headings` parameter(s) to false.
|
|
@@ -559,7 +580,7 @@ $ cat foo
|
|
|
559
580
|
$ less bar
|
|
560
581
|
```
|
|
561
582
|
|
|
562
|
-
<!-- markdownlint-
|
|
583
|
+
<!-- markdownlint-restore -->
|
|
563
584
|
|
|
564
585
|
The dollar signs are unnecessary in this situation, and should not be
|
|
565
586
|
included:
|
|
@@ -764,7 +785,7 @@ number of blank lines (including 0) above or below each heading.
|
|
|
764
785
|
Note: If `lines_above` or `lines_below` are configured to require more than one
|
|
765
786
|
blank line, [MD012/no-multiple-blanks](#md012) should also be customized.
|
|
766
787
|
|
|
767
|
-
Rationale: Aside from aesthetic reasons, some parsers, including kramdown
|
|
788
|
+
Rationale: Aside from aesthetic reasons, some parsers, including `kramdown`, will
|
|
768
789
|
not parse headings that don't have a blank line before, and will parse them as
|
|
769
790
|
regular text.
|
|
770
791
|
|
|
@@ -826,7 +847,7 @@ To fix this, ensure that the content of each heading is different:
|
|
|
826
847
|
|
|
827
848
|
If the parameter `siblings_only` (alternatively `allow_different_nesting`) is
|
|
828
849
|
set to `true`, heading duplication is allowed for non-sibling headings (common
|
|
829
|
-
in
|
|
850
|
+
in changelogs):
|
|
830
851
|
|
|
831
852
|
```markdown
|
|
832
853
|
# Change log
|
|
@@ -845,7 +866,7 @@ heading name; headings with the same content can cause problems with that.
|
|
|
845
866
|
|
|
846
867
|
<a name="md025"></a>
|
|
847
868
|
|
|
848
|
-
## MD025 - Multiple top
|
|
869
|
+
## MD025 - Multiple top-level headings in the same document
|
|
849
870
|
|
|
850
871
|
Tags: headings, headers
|
|
851
872
|
|
|
@@ -853,19 +874,19 @@ Aliases: single-title, single-h1
|
|
|
853
874
|
|
|
854
875
|
Parameters: level, front_matter_title (number; default 1, string; default "^\s*"?title"?\s*[:=]")
|
|
855
876
|
|
|
856
|
-
This rule is triggered when a top
|
|
857
|
-
the file is
|
|
877
|
+
This rule is triggered when a top-level heading is in use (the first line of
|
|
878
|
+
the file is an h1 heading), and more than one h1 heading is in use in the
|
|
858
879
|
document:
|
|
859
880
|
|
|
860
881
|
```markdown
|
|
861
882
|
# Top level heading
|
|
862
883
|
|
|
863
|
-
# Another top
|
|
884
|
+
# Another top-level heading
|
|
864
885
|
```
|
|
865
886
|
|
|
866
|
-
To fix, structure your document so
|
|
867
|
-
the title for the document
|
|
868
|
-
headings:
|
|
887
|
+
To fix, structure your document so there is a single h1 heading that is
|
|
888
|
+
the title for the document. Subsequent headings must be
|
|
889
|
+
lower-level headings (h2, h3, etc.):
|
|
869
890
|
|
|
870
891
|
```markdown
|
|
871
892
|
# Title
|
|
@@ -875,17 +896,17 @@ headings:
|
|
|
875
896
|
## Another heading
|
|
876
897
|
```
|
|
877
898
|
|
|
878
|
-
Note: The `level` parameter can be used to change the top
|
|
879
|
-
cases where
|
|
899
|
+
Note: The `level` parameter can be used to change the top-level (ex: to h2) in
|
|
900
|
+
cases where an h1 is added externally.
|
|
880
901
|
|
|
881
902
|
If [YAML](https://en.wikipedia.org/wiki/YAML) front matter is present and contains
|
|
882
903
|
a `title` property (commonly used with blog posts), this rule treats that as a top
|
|
883
|
-
level heading and will report a violation for any subsequent top
|
|
884
|
-
To use a different property name in front matter, specify the text of a regular
|
|
904
|
+
level heading and will report a violation for any subsequent top-level headings.
|
|
905
|
+
To use a different property name in the front matter, specify the text of a regular
|
|
885
906
|
expression via the `front_matter_title` parameter. To disable the use of front
|
|
886
907
|
matter by this rule, specify `""` for `front_matter_title`.
|
|
887
908
|
|
|
888
|
-
Rationale: A top
|
|
909
|
+
Rationale: A top-level heading is an h1 on the first line of the file, and
|
|
889
910
|
serves as the title for the document. If this convention is in use, then there
|
|
890
911
|
can not be more than one title for the document, and the entire document
|
|
891
912
|
should be contained within this heading.
|
|
@@ -917,7 +938,7 @@ To fix this, remove the trailing punctuation:
|
|
|
917
938
|
|
|
918
939
|
Note: The `punctuation` parameter can be used to specify what characters count
|
|
919
940
|
as punctuation at the end of a heading. For example, you can change it to
|
|
920
|
-
`".,;:"` to allow headings that end with an exclamation point.
|
|
941
|
+
`".,;:"` to allow headings that end with an exclamation point. `?` is
|
|
921
942
|
allowed by default because of how common it is in headings of FAQ-style documents.
|
|
922
943
|
Setting the `punctuation` parameter to `""` allows all characters - and is
|
|
923
944
|
equivalent to disabling the rule.
|
|
@@ -943,7 +964,7 @@ This rule is triggered when blockquotes have more than one space after the
|
|
|
943
964
|
blockquote (`>`) symbol:
|
|
944
965
|
|
|
945
966
|
```markdown
|
|
946
|
-
> This is a
|
|
967
|
+
> This is a blockquote with bad indentation
|
|
947
968
|
> there should only be one.
|
|
948
969
|
```
|
|
949
970
|
|
|
@@ -1011,7 +1032,7 @@ Parameters: style ("one", "ordered", "one_or_ordered", "zero"; default "one_or_o
|
|
|
1011
1032
|
|
|
1012
1033
|
This rule is triggered for ordered lists that do not either start with '1.' or
|
|
1013
1034
|
do not have a prefix that increases in numerical order (depending on the
|
|
1014
|
-
configured style). The less-common
|
|
1035
|
+
configured style). The less-common pattern of using '0.' as a first prefix or
|
|
1015
1036
|
for all prefixes is also supported.
|
|
1016
1037
|
|
|
1017
1038
|
Example valid list if the style is configured as 'one':
|
|
@@ -1064,8 +1085,9 @@ This rule supports 0-prefixing ordered list items for uniform indentation:
|
|
|
1064
1085
|
...
|
|
1065
1086
|
```
|
|
1066
1087
|
|
|
1067
|
-
Note: This rule will report violations for cases like the following where an
|
|
1068
|
-
|
|
1088
|
+
Note: This rule will report violations for cases like the following where an
|
|
1089
|
+
improperly-indented code block (or similar) appears between two list items and
|
|
1090
|
+
"breaks" the list in two:
|
|
1069
1091
|
|
|
1070
1092
|
<!-- markdownlint-disable code-fence-style -->
|
|
1071
1093
|
|
|
@@ -1079,7 +1101,8 @@ Code block
|
|
|
1079
1101
|
1. Second list
|
|
1080
1102
|
~~~
|
|
1081
1103
|
|
|
1082
|
-
The fix is to indent the code block so it becomes part of the preceding list
|
|
1104
|
+
The fix is to indent the code block so it becomes part of the preceding list
|
|
1105
|
+
item as intended:
|
|
1083
1106
|
|
|
1084
1107
|
~~~markdown
|
|
1085
1108
|
1. First list
|
|
@@ -1091,7 +1114,7 @@ The fix is to indent the code block so it becomes part of the preceding list ite
|
|
|
1091
1114
|
2. Still first list
|
|
1092
1115
|
~~~
|
|
1093
1116
|
|
|
1094
|
-
<!-- markdownlint-
|
|
1117
|
+
<!-- markdownlint-restore -->
|
|
1095
1118
|
|
|
1096
1119
|
Rationale: Consistent formatting makes it easier to understand a document.
|
|
1097
1120
|
|
|
@@ -1129,7 +1152,7 @@ default is 1 space after any list marker:
|
|
|
1129
1152
|
|
|
1130
1153
|
A document style may change the number of spaces after unordered list items
|
|
1131
1154
|
and ordered list items independently, as well as based on whether the content
|
|
1132
|
-
of every item in the list consists of a single paragraph
|
|
1155
|
+
of every item in the list consists of a single paragraph or multiple
|
|
1133
1156
|
paragraphs (including sub-lists and code blocks).
|
|
1134
1157
|
|
|
1135
1158
|
For example, the style guide at
|
|
@@ -1165,11 +1188,13 @@ or
|
|
|
1165
1188
|
1. Bar
|
|
1166
1189
|
```
|
|
1167
1190
|
|
|
1168
|
-
To fix this, ensure the correct number of spaces are used after list marker
|
|
1191
|
+
To fix this, ensure the correct number of spaces are used after the list marker
|
|
1169
1192
|
for your selected document style.
|
|
1170
1193
|
|
|
1171
1194
|
Rationale: Violations of this rule can lead to improperly rendered content.
|
|
1172
1195
|
|
|
1196
|
+
Note: See [Prettier.md](Prettier.md) for compatibility information.
|
|
1197
|
+
|
|
1173
1198
|
<a name="md031"></a>
|
|
1174
1199
|
|
|
1175
1200
|
## MD031 - Fenced code blocks should be surrounded by blank lines
|
|
@@ -1314,20 +1339,20 @@ For more information, see <https://www.example.com/>.
|
|
|
1314
1339
|
```
|
|
1315
1340
|
|
|
1316
1341
|
Note: To use a bare URL without it being converted into a link, enclose it in
|
|
1317
|
-
a code block, otherwise in some markdown parsers it
|
|
1342
|
+
a code block, otherwise in some markdown parsers it *will* be converted:
|
|
1318
1343
|
|
|
1319
1344
|
```markdown
|
|
1320
1345
|
`https://www.example.com`
|
|
1321
1346
|
```
|
|
1322
1347
|
|
|
1323
|
-
Note: The following scenario does
|
|
1348
|
+
Note: The following scenario does *not* trigger this rule to avoid conflicts
|
|
1324
1349
|
with `MD011`/`no-reversed-links`:
|
|
1325
1350
|
|
|
1326
1351
|
```markdown
|
|
1327
1352
|
[https://www.example.com]
|
|
1328
1353
|
```
|
|
1329
1354
|
|
|
1330
|
-
The use of quotes around a bare link will
|
|
1355
|
+
The use of quotes around a bare link will *not* trigger this rule, either:
|
|
1331
1356
|
|
|
1332
1357
|
```markdown
|
|
1333
1358
|
"https://www.example.com"
|
|
@@ -1345,8 +1370,8 @@ Tags: hr
|
|
|
1345
1370
|
|
|
1346
1371
|
Aliases: hr-style
|
|
1347
1372
|
|
|
1348
|
-
Parameters: style ("consistent", "---", "***", or other string specifying
|
|
1349
|
-
horizontal rule; default "consistent")
|
|
1373
|
+
Parameters: style ("consistent", "---", "***", "___", or other string specifying
|
|
1374
|
+
the horizontal rule; default "consistent")
|
|
1350
1375
|
|
|
1351
1376
|
This rule is triggered when inconsistent styles of horizontal rules are used
|
|
1352
1377
|
in the document:
|
|
@@ -1373,7 +1398,7 @@ or match the given style if the rule is so configured:
|
|
|
1373
1398
|
```
|
|
1374
1399
|
|
|
1375
1400
|
Note: by default, this rule is configured to just require that all horizontal
|
|
1376
|
-
rules in the document are the same
|
|
1401
|
+
rules in the document are the same and will trigger if any of the horizontal
|
|
1377
1402
|
rules are different than the first one encountered in the document. If you
|
|
1378
1403
|
want to configure the rule to match a specific style, the parameter given to
|
|
1379
1404
|
the 'style' option is a string containing the exact horizontal rule text that
|
|
@@ -1417,7 +1442,7 @@ Lorem ipsum dolor sit amet...
|
|
|
1417
1442
|
Consectetur adipiscing elit, sed do eiusmod.
|
|
1418
1443
|
```
|
|
1419
1444
|
|
|
1420
|
-
Note: This rule looks for single
|
|
1445
|
+
Note: This rule looks for single-line paragraphs that consist entirely
|
|
1421
1446
|
of emphasized text. It won't fire on emphasis used within regular text,
|
|
1422
1447
|
multi-line emphasized paragraphs, or paragraphs ending in punctuation
|
|
1423
1448
|
(normal or full-width). Similarly to rule MD026, you can configure what
|
|
@@ -1463,7 +1488,7 @@ Here is some more _italic_ text.
|
|
|
1463
1488
|
```
|
|
1464
1489
|
|
|
1465
1490
|
Rationale: Emphasis is only parsed as such when the asterisks/underscores
|
|
1466
|
-
aren't
|
|
1491
|
+
aren't surrounded by spaces. This rule attempts to detect where
|
|
1467
1492
|
they were surrounded by spaces, but it appears that emphasized text was
|
|
1468
1493
|
intended by the author.
|
|
1469
1494
|
|
|
@@ -1499,7 +1524,7 @@ automatically trimmed (to allow for embedded backticks):
|
|
|
1499
1524
|
`` `backticks` ``
|
|
1500
1525
|
```
|
|
1501
1526
|
|
|
1502
|
-
Note: A single leading or trailing space is allowed if used to separate
|
|
1527
|
+
Note: A single leading or trailing space is allowed if used to separate code span
|
|
1503
1528
|
markers from an embedded backtick:
|
|
1504
1529
|
|
|
1505
1530
|
```markdown
|
|
@@ -1559,13 +1584,21 @@ echo Hello world
|
|
|
1559
1584
|
```
|
|
1560
1585
|
````
|
|
1561
1586
|
|
|
1587
|
+
To display a code block without syntax highlighting, use:
|
|
1588
|
+
|
|
1589
|
+
````markdown
|
|
1590
|
+
```text
|
|
1591
|
+
Plain text in a code block
|
|
1592
|
+
```
|
|
1593
|
+
````
|
|
1594
|
+
|
|
1562
1595
|
Rationale: Specifying a language improves content rendering by using the
|
|
1563
1596
|
correct syntax highlighting for code. More information:
|
|
1564
1597
|
<https://cirosantilli.com/markdown-style-guide#option-code-fenced>.
|
|
1565
1598
|
|
|
1566
1599
|
<a name="md041"></a>
|
|
1567
1600
|
|
|
1568
|
-
## MD041 - First line in file should be a top
|
|
1601
|
+
## MD041 - First line in a file should be a top-level heading
|
|
1569
1602
|
|
|
1570
1603
|
Tags: headings, headers
|
|
1571
1604
|
|
|
@@ -1574,30 +1607,40 @@ Aliases: first-line-heading, first-line-h1
|
|
|
1574
1607
|
Parameters: level, front_matter_title (number; default 1, string; default "^\s*"?title"?\s*[:=]")
|
|
1575
1608
|
|
|
1576
1609
|
This rule is intended to ensure documents have a title and is triggered when
|
|
1577
|
-
the first line in the file isn't a top
|
|
1610
|
+
the first line in the file isn't a top-level (h1) heading:
|
|
1578
1611
|
|
|
1579
1612
|
```markdown
|
|
1580
1613
|
This is a file without a heading
|
|
1581
1614
|
```
|
|
1582
1615
|
|
|
1583
|
-
To fix this, add a top
|
|
1616
|
+
To fix this, add a top-level heading to the beginning of the file:
|
|
1584
1617
|
|
|
1585
1618
|
```markdown
|
|
1586
1619
|
# File with heading
|
|
1587
1620
|
|
|
1588
|
-
This is a file with a top
|
|
1621
|
+
This is a file with a top-level heading
|
|
1622
|
+
```
|
|
1623
|
+
|
|
1624
|
+
Because it is common for projects on GitHub to use an image for the heading of
|
|
1625
|
+
`README.md` and that is not well-supported by Markdown, HTML headings are also
|
|
1626
|
+
permitted by this rule. For example:
|
|
1627
|
+
|
|
1628
|
+
```markdown
|
|
1629
|
+
<h1 align="center"><img src="https://placekitten.com/300/150"/></h1>
|
|
1630
|
+
|
|
1631
|
+
This is a file with a top-level HTML heading
|
|
1589
1632
|
```
|
|
1590
1633
|
|
|
1591
|
-
Note: The `level` parameter can be used to change the top
|
|
1592
|
-
where
|
|
1634
|
+
Note: The `level` parameter can be used to change the top-level (ex: to h2) in cases
|
|
1635
|
+
where an h1 is added externally.
|
|
1593
1636
|
|
|
1594
|
-
If [YAML](https://en.wikipedia.org/wiki/YAML) front matter is present and
|
|
1595
|
-
`title` property (commonly used with blog posts), this rule will not
|
|
1596
|
-
violation. To use a different property name in front matter,
|
|
1597
|
-
of a regular expression via the `front_matter_title` parameter.
|
|
1598
|
-
use of front matter by this rule, specify `""` for `front_matter_title`.
|
|
1637
|
+
If [YAML](https://en.wikipedia.org/wiki/YAML) front matter is present and
|
|
1638
|
+
contains a `title` property (commonly used with blog posts), this rule will not
|
|
1639
|
+
report a violation. To use a different property name in the front matter,
|
|
1640
|
+
specify the text of a regular expression via the `front_matter_title` parameter.
|
|
1641
|
+
To disable the use of front matter by this rule, specify `""` for `front_matter_title`.
|
|
1599
1642
|
|
|
1600
|
-
Rationale: The top
|
|
1643
|
+
Rationale: The top-level heading often acts as the title of a document. More
|
|
1601
1644
|
information: <https://cirosantilli.com/markdown-style-guide#top-level-header>.
|
|
1602
1645
|
|
|
1603
1646
|
<a name="md042"></a>
|
|
@@ -1727,7 +1770,8 @@ the proper capitalization, specify the desired letter case in the `names` array:
|
|
|
1727
1770
|
]
|
|
1728
1771
|
```
|
|
1729
1772
|
|
|
1730
|
-
Set the `code_blocks` parameter to `false` to disable this rule for code blocks
|
|
1773
|
+
Set the `code_blocks` parameter to `false` to disable this rule for code blocks
|
|
1774
|
+
and spans.
|
|
1731
1775
|
|
|
1732
1776
|
Rationale: Incorrect capitalization of proper names is usually a mistake.
|
|
1733
1777
|
|
|
@@ -1793,12 +1837,13 @@ In the default configuration this rule reports a violation for the following doc
|
|
|
1793
1837
|
|
|
1794
1838
|
More text.
|
|
1795
1839
|
|
|
1796
|
-
<!-- markdownlint-
|
|
1840
|
+
<!-- markdownlint-restore -->
|
|
1797
1841
|
|
|
1798
|
-
To fix violations of this rule, use a consistent style (either indenting or code
|
|
1842
|
+
To fix violations of this rule, use a consistent style (either indenting or code
|
|
1843
|
+
fences).
|
|
1799
1844
|
|
|
1800
|
-
The specified style can be specific (`fenced`, `indented`) or simply require
|
|
1801
|
-
be consistent within the document (`consistent`).
|
|
1845
|
+
The specified style can be specific (`fenced`, `indented`) or simply require
|
|
1846
|
+
that usage be consistent within the document (`consistent`).
|
|
1802
1847
|
|
|
1803
1848
|
Rationale: Consistent formatting makes it easier to understand a document.
|
|
1804
1849
|
|
|
@@ -1812,9 +1857,10 @@ Aliases: single-trailing-newline
|
|
|
1812
1857
|
|
|
1813
1858
|
Fixable: Most violations can be fixed by tooling
|
|
1814
1859
|
|
|
1815
|
-
This rule is triggered when there is not a single newline character at the end
|
|
1860
|
+
This rule is triggered when there is not a single newline character at the end
|
|
1861
|
+
of a file.
|
|
1816
1862
|
|
|
1817
|
-
|
|
1863
|
+
An example that triggers the rule:
|
|
1818
1864
|
|
|
1819
1865
|
```markdown
|
|
1820
1866
|
# Heading
|
|
@@ -1844,7 +1890,8 @@ Aliases: code-fence-style
|
|
|
1844
1890
|
|
|
1845
1891
|
Parameters: style ("consistent", "tilde", "backtick"; default "consistent")
|
|
1846
1892
|
|
|
1847
|
-
This rule is triggered when the symbols used in the document for fenced code
|
|
1893
|
+
This rule is triggered when the symbols used in the document for fenced code
|
|
1894
|
+
blocks do not match the configured code fence style:
|
|
1848
1895
|
|
|
1849
1896
|
````markdown
|
|
1850
1897
|
```ruby
|
|
@@ -1873,3 +1920,67 @@ The configured list style can be a specific symbol to use (backtick, tilde), or
|
|
|
1873
1920
|
can require that usage be consistent within the document.
|
|
1874
1921
|
|
|
1875
1922
|
Rationale: Consistent formatting makes it easier to understand a document.
|
|
1923
|
+
|
|
1924
|
+
<a name="md049"></a>
|
|
1925
|
+
|
|
1926
|
+
## MD049 - Emphasis style should be consistent
|
|
1927
|
+
|
|
1928
|
+
Tags: emphasis
|
|
1929
|
+
|
|
1930
|
+
Aliases: emphasis-style
|
|
1931
|
+
|
|
1932
|
+
Parameters: style ("consistent", "asterisk", "underscore"; default "consistent")
|
|
1933
|
+
|
|
1934
|
+
Fixable: Most violations can be fixed by tooling
|
|
1935
|
+
|
|
1936
|
+
This rule is triggered when the symbols used in the document for emphasis do not
|
|
1937
|
+
match the configured emphasis style:
|
|
1938
|
+
|
|
1939
|
+
```markdown
|
|
1940
|
+
*Text*
|
|
1941
|
+
_Text_
|
|
1942
|
+
```
|
|
1943
|
+
|
|
1944
|
+
To fix this issue, use the configured emphasis style throughout the document:
|
|
1945
|
+
|
|
1946
|
+
```markdown
|
|
1947
|
+
*Text*
|
|
1948
|
+
*Text*
|
|
1949
|
+
```
|
|
1950
|
+
|
|
1951
|
+
The configured emphasis style can be a specific symbol to use ("asterisk",
|
|
1952
|
+
"underscore"), or can require that usage be consistent within the document.
|
|
1953
|
+
|
|
1954
|
+
Rationale: Consistent formatting makes it easier to understand a document.
|
|
1955
|
+
|
|
1956
|
+
<a name="md050"></a>
|
|
1957
|
+
|
|
1958
|
+
## MD050 - Strong style should be consistent
|
|
1959
|
+
|
|
1960
|
+
Tags: emphasis
|
|
1961
|
+
|
|
1962
|
+
Aliases: strong-style
|
|
1963
|
+
|
|
1964
|
+
Parameters: style ("consistent", "asterisk", "underscore"; default "consistent")
|
|
1965
|
+
|
|
1966
|
+
Fixable: Most violations can be fixed by tooling
|
|
1967
|
+
|
|
1968
|
+
This rule is triggered when the symbols used in the document for strong do not
|
|
1969
|
+
match the configured strong style:
|
|
1970
|
+
|
|
1971
|
+
```markdown
|
|
1972
|
+
**Text**
|
|
1973
|
+
__Text__
|
|
1974
|
+
```
|
|
1975
|
+
|
|
1976
|
+
To fix this issue, use the configured strong style throughout the document:
|
|
1977
|
+
|
|
1978
|
+
```markdown
|
|
1979
|
+
**Text**
|
|
1980
|
+
**Text**
|
|
1981
|
+
```
|
|
1982
|
+
|
|
1983
|
+
The configured strong style can be a specific symbol to use ("asterisk",
|
|
1984
|
+
"underscore"), or can require that usage be consistent within the document.
|
|
1985
|
+
|
|
1986
|
+
Rationale: Consistent formatting makes it easier to understand a document.
|
package/helpers/LICENSE
CHANGED