markdownlint 0.21.1 → 0.24.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 +1 -0
- package/LICENSE +1 -1
- package/README.md +140 -80
- package/demo/markdownlint-browser.js +1209 -1701
- package/doc/Prettier.md +23 -0
- package/doc/Rules.md +121 -76
- package/helpers/LICENSE +1 -1
- package/helpers/helpers.js +126 -37
- package/helpers/package.json +1 -1
- package/lib/cache.js +18 -9
- package/lib/markdownlint.d.ts +28 -12
- package/lib/markdownlint.js +185 -62
- package/lib/md002.js +1 -1
- package/lib/md004.js +46 -13
- package/lib/md006.js +1 -1
- package/lib/md009.js +25 -23
- package/lib/md010.js +5 -1
- 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/md026.js +7 -4
- package/lib/md028.js +1 -9
- package/lib/md032.js +2 -2
- package/lib/md037.js +35 -9
- package/lib/md039.js +2 -2
- package/lib/md041.js +14 -3
- package/lib/md043.js +27 -11
- package/lib/md044.js +54 -71
- package/lib/rules.js +2 -1
- package/package.json +39 -32
- package/schema/.markdownlint.jsonc +252 -0
- package/schema/.markdownlint.yaml +227 -0
- package/schema/markdownlint-config-schema.json +36 -23
- package/schema/build-config-schema.js +0 -409
package/doc/Prettier.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Using markdownlint with Prettier
|
|
2
|
+
|
|
3
|
+
[`Prettier`](https://prettier.io) is a popular code formatter. For the most part,
|
|
4
|
+
it works seamlessly with `markdownlint`. Special situations are documented
|
|
5
|
+
below.
|
|
6
|
+
|
|
7
|
+
## List item indentation
|
|
8
|
+
|
|
9
|
+
The default settings of `markdownlint` and `Prettier` are compatible and don't
|
|
10
|
+
result in any linting violations. If `Prettier` is used with `--tab-width` set
|
|
11
|
+
to `4`, the following `markdownlint` configuration can be used:
|
|
12
|
+
|
|
13
|
+
```json
|
|
14
|
+
{
|
|
15
|
+
"MD007": {
|
|
16
|
+
"indent": 4
|
|
17
|
+
},
|
|
18
|
+
"MD030": {
|
|
19
|
+
"ul_single": 3,
|
|
20
|
+
"ul_multi": 3
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
```
|
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
|
|
@@ -322,10 +325,12 @@ Rationale: Indenting by 2 spaces allows the content of a nested list to be in
|
|
|
322
325
|
line with the start of the content of the parent list when a single space is
|
|
323
326
|
used after the list marker. Indenting by 4 spaces is consistent with code blocks
|
|
324
327
|
and simpler for editors to implement. Additionally, this can be a compatibility
|
|
325
|
-
issue for multi-markdown parsers, which require
|
|
328
|
+
issue for multi-markdown parsers, which require 4-space indents. More information:
|
|
326
329
|
<https://cirosantilli.com/markdown-style-guide#indentation-of-content-inside-lists>
|
|
327
330
|
and <http://support.markedapp.com/discussions/problems/21-sub-lists-not-indenting>.
|
|
328
331
|
|
|
332
|
+
Note: See [Prettier.md](Prettier.md) for compatibility information.
|
|
333
|
+
|
|
329
334
|
<a name="md009"></a>
|
|
330
335
|
|
|
331
336
|
## MD009 - Trailing spaces
|
|
@@ -334,13 +339,20 @@ Tags: whitespace
|
|
|
334
339
|
|
|
335
340
|
Aliases: no-trailing-spaces
|
|
336
341
|
|
|
342
|
+
<!-- markdownlint-disable line-length -->
|
|
343
|
+
|
|
337
344
|
Parameters: br_spaces, list_item_empty_lines, strict (number; default 2, boolean; default false, boolean; default false)
|
|
338
345
|
|
|
346
|
+
<!-- markdownlint-restore -->
|
|
347
|
+
|
|
339
348
|
Fixable: Most violations can be fixed by tooling
|
|
340
349
|
|
|
341
350
|
This rule is triggered on any lines that end with unexpected whitespace. To fix this,
|
|
342
351
|
remove the trailing space from the end of the line.
|
|
343
352
|
|
|
353
|
+
Note: Trailing space is allowed in indented and fenced code blocks because some
|
|
354
|
+
languages require it.
|
|
355
|
+
|
|
344
356
|
The `br_spaces` parameter allows an exception to this rule for a specific number
|
|
345
357
|
of trailing spaces, typically used to insert an explicit line break. The default
|
|
346
358
|
value allows 2 spaces to indicate a hard break (\<br> element).
|
|
@@ -378,7 +390,7 @@ Tags: whitespace, hard_tab
|
|
|
378
390
|
|
|
379
391
|
Aliases: no-hard-tabs
|
|
380
392
|
|
|
381
|
-
Parameters: code_blocks (boolean; default true)
|
|
393
|
+
Parameters: code_blocks, spaces_per_tab (boolean; default true, number; default 1)
|
|
382
394
|
|
|
383
395
|
Fixable: Most violations can be fixed by tooling
|
|
384
396
|
|
|
@@ -396,7 +408,7 @@ Some text
|
|
|
396
408
|
* hard tab character used to indent the list item
|
|
397
409
|
```
|
|
398
410
|
|
|
399
|
-
<!-- markdownlint-
|
|
411
|
+
<!-- markdownlint-restore -->
|
|
400
412
|
|
|
401
413
|
Corrected example:
|
|
402
414
|
|
|
@@ -410,6 +422,9 @@ You have the option to exclude this rule for code blocks. To do so, set the
|
|
|
410
422
|
`code_blocks` parameter to `false`. Code blocks are included by default since
|
|
411
423
|
handling of tabs by tools is often inconsistent (ex: using 4 vs. 8 spaces).
|
|
412
424
|
|
|
425
|
+
If you would like the fixer to change tabs to x spaces, then configure the `spaces_per_tab`
|
|
426
|
+
parameter to the number x. The default value would be 1.
|
|
427
|
+
|
|
413
428
|
Rationale: Hard tabs are often rendered inconsistently by different editors and
|
|
414
429
|
can be harder to work with than spaces.
|
|
415
430
|
|
|
@@ -437,7 +452,8 @@ To fix this, swap the `[]` and `()` around:
|
|
|
437
452
|
[Correct link syntax](https://www.example.com/)
|
|
438
453
|
```
|
|
439
454
|
|
|
440
|
-
Note: [Markdown Extra](https://en.wikipedia.org/wiki/Markdown_Extra)-style
|
|
455
|
+
Note: [Markdown Extra](https://en.wikipedia.org/wiki/Markdown_Extra)-style
|
|
456
|
+
footnotes do not trigger this rule:
|
|
441
457
|
|
|
442
458
|
```markdown
|
|
443
459
|
For (example)[^1]
|
|
@@ -496,7 +512,7 @@ Aliases: line-length
|
|
|
496
512
|
|
|
497
513
|
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))
|
|
498
514
|
|
|
499
|
-
<!-- markdownlint-
|
|
515
|
+
<!-- markdownlint-restore -->
|
|
500
516
|
|
|
501
517
|
> If `headings` is not provided, `headers` (deprecated) will be used.
|
|
502
518
|
|
|
@@ -523,7 +539,7 @@ This-line-is-also-okay-because-there-are-no-spaces
|
|
|
523
539
|
```
|
|
524
540
|
|
|
525
541
|
In `strict` or `stern` modes, the two middle lines above are a violation. The
|
|
526
|
-
third line is a violation in `strict` mode
|
|
542
|
+
third line is a violation in `strict` mode but allowed in `stern` mode.
|
|
527
543
|
|
|
528
544
|
You have the option to exclude this rule for code blocks, tables, or headings.
|
|
529
545
|
To do so, set the `code_blocks`, `tables`, or `headings` parameter(s) to false.
|
|
@@ -556,7 +572,7 @@ $ cat foo
|
|
|
556
572
|
$ less bar
|
|
557
573
|
```
|
|
558
574
|
|
|
559
|
-
<!-- markdownlint-
|
|
575
|
+
<!-- markdownlint-restore -->
|
|
560
576
|
|
|
561
577
|
The dollar signs are unnecessary in this situation, and should not be
|
|
562
578
|
included:
|
|
@@ -761,7 +777,7 @@ number of blank lines (including 0) above or below each heading.
|
|
|
761
777
|
Note: If `lines_above` or `lines_below` are configured to require more than one
|
|
762
778
|
blank line, [MD012/no-multiple-blanks](#md012) should also be customized.
|
|
763
779
|
|
|
764
|
-
Rationale: Aside from aesthetic reasons, some parsers, including kramdown
|
|
780
|
+
Rationale: Aside from aesthetic reasons, some parsers, including `kramdown`, will
|
|
765
781
|
not parse headings that don't have a blank line before, and will parse them as
|
|
766
782
|
regular text.
|
|
767
783
|
|
|
@@ -823,7 +839,7 @@ To fix this, ensure that the content of each heading is different:
|
|
|
823
839
|
|
|
824
840
|
If the parameter `siblings_only` (alternatively `allow_different_nesting`) is
|
|
825
841
|
set to `true`, heading duplication is allowed for non-sibling headings (common
|
|
826
|
-
in
|
|
842
|
+
in changelogs):
|
|
827
843
|
|
|
828
844
|
```markdown
|
|
829
845
|
# Change log
|
|
@@ -842,27 +858,27 @@ heading name; headings with the same content can cause problems with that.
|
|
|
842
858
|
|
|
843
859
|
<a name="md025"></a>
|
|
844
860
|
|
|
845
|
-
## MD025 - Multiple top
|
|
861
|
+
## MD025 - Multiple top-level headings in the same document
|
|
846
862
|
|
|
847
863
|
Tags: headings, headers
|
|
848
864
|
|
|
849
865
|
Aliases: single-title, single-h1
|
|
850
866
|
|
|
851
|
-
Parameters: level, front_matter_title (number; default 1, string; default "^\s*title
|
|
867
|
+
Parameters: level, front_matter_title (number; default 1, string; default "^\s*"?title"?\s*[:=]")
|
|
852
868
|
|
|
853
|
-
This rule is triggered when a top
|
|
854
|
-
the file is
|
|
869
|
+
This rule is triggered when a top-level heading is in use (the first line of
|
|
870
|
+
the file is an h1 heading), and more than one h1 heading is in use in the
|
|
855
871
|
document:
|
|
856
872
|
|
|
857
873
|
```markdown
|
|
858
874
|
# Top level heading
|
|
859
875
|
|
|
860
|
-
# Another top
|
|
876
|
+
# Another top-level heading
|
|
861
877
|
```
|
|
862
878
|
|
|
863
|
-
To fix, structure your document so
|
|
864
|
-
the title for the document
|
|
865
|
-
headings:
|
|
879
|
+
To fix, structure your document so there is a single h1 heading that is
|
|
880
|
+
the title for the document. Subsequent headings must be
|
|
881
|
+
lower-level headings (h2, h3, etc.):
|
|
866
882
|
|
|
867
883
|
```markdown
|
|
868
884
|
# Title
|
|
@@ -872,17 +888,17 @@ headings:
|
|
|
872
888
|
## Another heading
|
|
873
889
|
```
|
|
874
890
|
|
|
875
|
-
Note: The `level` parameter can be used to change the top
|
|
876
|
-
cases where
|
|
891
|
+
Note: The `level` parameter can be used to change the top-level (ex: to h2) in
|
|
892
|
+
cases where an h1 is added externally.
|
|
877
893
|
|
|
878
894
|
If [YAML](https://en.wikipedia.org/wiki/YAML) front matter is present and contains
|
|
879
895
|
a `title` property (commonly used with blog posts), this rule treats that as a top
|
|
880
|
-
level heading and will report a violation for any subsequent top
|
|
881
|
-
To use a different property name in front matter, specify the text of a regular
|
|
896
|
+
level heading and will report a violation for any subsequent top-level headings.
|
|
897
|
+
To use a different property name in the front matter, specify the text of a regular
|
|
882
898
|
expression via the `front_matter_title` parameter. To disable the use of front
|
|
883
899
|
matter by this rule, specify `""` for `front_matter_title`.
|
|
884
900
|
|
|
885
|
-
Rationale: A top
|
|
901
|
+
Rationale: A top-level heading is an h1 on the first line of the file, and
|
|
886
902
|
serves as the title for the document. If this convention is in use, then there
|
|
887
903
|
can not be more than one title for the document, and the entire document
|
|
888
904
|
should be contained within this heading.
|
|
@@ -895,7 +911,7 @@ Tags: headings, headers
|
|
|
895
911
|
|
|
896
912
|
Aliases: no-trailing-punctuation
|
|
897
913
|
|
|
898
|
-
Parameters: punctuation (string; default "
|
|
914
|
+
Parameters: punctuation (string; default ".,;:!。,;:!")
|
|
899
915
|
|
|
900
916
|
Fixable: Most violations can be fixed by tooling
|
|
901
917
|
|
|
@@ -914,10 +930,15 @@ To fix this, remove the trailing punctuation:
|
|
|
914
930
|
|
|
915
931
|
Note: The `punctuation` parameter can be used to specify what characters count
|
|
916
932
|
as punctuation at the end of a heading. For example, you can change it to
|
|
917
|
-
`"
|
|
933
|
+
`".,;:"` to allow headings that end with an exclamation point. `?` is
|
|
934
|
+
allowed by default because of how common it is in headings of FAQ-style documents.
|
|
918
935
|
Setting the `punctuation` parameter to `""` allows all characters - and is
|
|
919
936
|
equivalent to disabling the rule.
|
|
920
937
|
|
|
938
|
+
Note: The trailing semicolon of
|
|
939
|
+
[HTML entity references](https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references)
|
|
940
|
+
like `©`, `©`, and `©` is ignored by this rule.
|
|
941
|
+
|
|
921
942
|
Rationale: Headings are not meant to be full sentences. More information:
|
|
922
943
|
<https://cirosantilli.com/markdown-style-guide#punctuation-at-the-end-of-headers>
|
|
923
944
|
|
|
@@ -935,7 +956,7 @@ This rule is triggered when blockquotes have more than one space after the
|
|
|
935
956
|
blockquote (`>`) symbol:
|
|
936
957
|
|
|
937
958
|
```markdown
|
|
938
|
-
> This is a
|
|
959
|
+
> This is a blockquote with bad indentation
|
|
939
960
|
> there should only be one.
|
|
940
961
|
```
|
|
941
962
|
|
|
@@ -956,8 +977,6 @@ Tags: blockquote, whitespace
|
|
|
956
977
|
|
|
957
978
|
Aliases: no-blanks-blockquote
|
|
958
979
|
|
|
959
|
-
Fixable: Most violations can be fixed by tooling
|
|
960
|
-
|
|
961
980
|
This rule is triggered when two blockquote blocks are separated by nothing
|
|
962
981
|
except for a blank line:
|
|
963
982
|
|
|
@@ -1005,7 +1024,7 @@ Parameters: style ("one", "ordered", "one_or_ordered", "zero"; default "one_or_o
|
|
|
1005
1024
|
|
|
1006
1025
|
This rule is triggered for ordered lists that do not either start with '1.' or
|
|
1007
1026
|
do not have a prefix that increases in numerical order (depending on the
|
|
1008
|
-
configured style). The less-common
|
|
1027
|
+
configured style). The less-common pattern of using '0.' as a first prefix or
|
|
1009
1028
|
for all prefixes is also supported.
|
|
1010
1029
|
|
|
1011
1030
|
Example valid list if the style is configured as 'one':
|
|
@@ -1058,8 +1077,9 @@ This rule supports 0-prefixing ordered list items for uniform indentation:
|
|
|
1058
1077
|
...
|
|
1059
1078
|
```
|
|
1060
1079
|
|
|
1061
|
-
Note: This rule will report violations for cases like the following where an
|
|
1062
|
-
|
|
1080
|
+
Note: This rule will report violations for cases like the following where an
|
|
1081
|
+
improperly-indented code block (or similar) appears between two list items and
|
|
1082
|
+
"breaks" the list in two:
|
|
1063
1083
|
|
|
1064
1084
|
<!-- markdownlint-disable code-fence-style -->
|
|
1065
1085
|
|
|
@@ -1073,7 +1093,8 @@ Code block
|
|
|
1073
1093
|
1. Second list
|
|
1074
1094
|
~~~
|
|
1075
1095
|
|
|
1076
|
-
The fix is to indent the code block so it becomes part of the preceding list
|
|
1096
|
+
The fix is to indent the code block so it becomes part of the preceding list
|
|
1097
|
+
item as intended:
|
|
1077
1098
|
|
|
1078
1099
|
~~~markdown
|
|
1079
1100
|
1. First list
|
|
@@ -1085,7 +1106,7 @@ The fix is to indent the code block so it becomes part of the preceding list ite
|
|
|
1085
1106
|
2. Still first list
|
|
1086
1107
|
~~~
|
|
1087
1108
|
|
|
1088
|
-
<!-- markdownlint-
|
|
1109
|
+
<!-- markdownlint-restore -->
|
|
1089
1110
|
|
|
1090
1111
|
Rationale: Consistent formatting makes it easier to understand a document.
|
|
1091
1112
|
|
|
@@ -1123,7 +1144,7 @@ default is 1 space after any list marker:
|
|
|
1123
1144
|
|
|
1124
1145
|
A document style may change the number of spaces after unordered list items
|
|
1125
1146
|
and ordered list items independently, as well as based on whether the content
|
|
1126
|
-
of every item in the list consists of a single paragraph
|
|
1147
|
+
of every item in the list consists of a single paragraph or multiple
|
|
1127
1148
|
paragraphs (including sub-lists and code blocks).
|
|
1128
1149
|
|
|
1129
1150
|
For example, the style guide at
|
|
@@ -1159,11 +1180,13 @@ or
|
|
|
1159
1180
|
1. Bar
|
|
1160
1181
|
```
|
|
1161
1182
|
|
|
1162
|
-
To fix this, ensure the correct number of spaces are used after list marker
|
|
1183
|
+
To fix this, ensure the correct number of spaces are used after the list marker
|
|
1163
1184
|
for your selected document style.
|
|
1164
1185
|
|
|
1165
1186
|
Rationale: Violations of this rule can lead to improperly rendered content.
|
|
1166
1187
|
|
|
1188
|
+
Note: See [Prettier.md](Prettier.md) for compatibility information.
|
|
1189
|
+
|
|
1167
1190
|
<a name="md031"></a>
|
|
1168
1191
|
|
|
1169
1192
|
## MD031 - Fenced code blocks should be surrounded by blank lines
|
|
@@ -1367,7 +1390,7 @@ or match the given style if the rule is so configured:
|
|
|
1367
1390
|
```
|
|
1368
1391
|
|
|
1369
1392
|
Note: by default, this rule is configured to just require that all horizontal
|
|
1370
|
-
rules in the document are the same
|
|
1393
|
+
rules in the document are the same and will trigger if any of the horizontal
|
|
1371
1394
|
rules are different than the first one encountered in the document. If you
|
|
1372
1395
|
want to configure the rule to match a specific style, the parameter given to
|
|
1373
1396
|
the 'style' option is a string containing the exact horizontal rule text that
|
|
@@ -1411,7 +1434,7 @@ Lorem ipsum dolor sit amet...
|
|
|
1411
1434
|
Consectetur adipiscing elit, sed do eiusmod.
|
|
1412
1435
|
```
|
|
1413
1436
|
|
|
1414
|
-
Note: This rule looks for single
|
|
1437
|
+
Note: This rule looks for single-line paragraphs that consist entirely
|
|
1415
1438
|
of emphasized text. It won't fire on emphasis used within regular text,
|
|
1416
1439
|
multi-line emphasized paragraphs, or paragraphs ending in punctuation
|
|
1417
1440
|
(normal or full-width). Similarly to rule MD026, you can configure what
|
|
@@ -1457,7 +1480,7 @@ Here is some more _italic_ text.
|
|
|
1457
1480
|
```
|
|
1458
1481
|
|
|
1459
1482
|
Rationale: Emphasis is only parsed as such when the asterisks/underscores
|
|
1460
|
-
aren't
|
|
1483
|
+
aren't surrounded by spaces. This rule attempts to detect where
|
|
1461
1484
|
they were surrounded by spaces, but it appears that emphasized text was
|
|
1462
1485
|
intended by the author.
|
|
1463
1486
|
|
|
@@ -1493,7 +1516,7 @@ automatically trimmed (to allow for embedded backticks):
|
|
|
1493
1516
|
`` `backticks` ``
|
|
1494
1517
|
```
|
|
1495
1518
|
|
|
1496
|
-
Note: A single leading or trailing space is allowed if used to separate
|
|
1519
|
+
Note: A single leading or trailing space is allowed if used to separate code span
|
|
1497
1520
|
markers from an embedded backtick:
|
|
1498
1521
|
|
|
1499
1522
|
```markdown
|
|
@@ -1553,45 +1576,63 @@ echo Hello world
|
|
|
1553
1576
|
```
|
|
1554
1577
|
````
|
|
1555
1578
|
|
|
1579
|
+
To display a code block without syntax highlighting, use:
|
|
1580
|
+
|
|
1581
|
+
````markdown
|
|
1582
|
+
```text
|
|
1583
|
+
Plain text in a code block
|
|
1584
|
+
```
|
|
1585
|
+
````
|
|
1586
|
+
|
|
1556
1587
|
Rationale: Specifying a language improves content rendering by using the
|
|
1557
1588
|
correct syntax highlighting for code. More information:
|
|
1558
1589
|
<https://cirosantilli.com/markdown-style-guide#option-code-fenced>.
|
|
1559
1590
|
|
|
1560
1591
|
<a name="md041"></a>
|
|
1561
1592
|
|
|
1562
|
-
## MD041 - First line in file should be a top
|
|
1593
|
+
## MD041 - First line in a file should be a top-level heading
|
|
1563
1594
|
|
|
1564
1595
|
Tags: headings, headers
|
|
1565
1596
|
|
|
1566
1597
|
Aliases: first-line-heading, first-line-h1
|
|
1567
1598
|
|
|
1568
|
-
Parameters: level, front_matter_title (number; default 1, string; default "^\s*title
|
|
1599
|
+
Parameters: level, front_matter_title (number; default 1, string; default "^\s*"?title"?\s*[:=]")
|
|
1569
1600
|
|
|
1570
1601
|
This rule is intended to ensure documents have a title and is triggered when
|
|
1571
|
-
the first line in the file isn't a top
|
|
1602
|
+
the first line in the file isn't a top-level (h1) heading:
|
|
1572
1603
|
|
|
1573
1604
|
```markdown
|
|
1574
1605
|
This is a file without a heading
|
|
1575
1606
|
```
|
|
1576
1607
|
|
|
1577
|
-
To fix this, add a top
|
|
1608
|
+
To fix this, add a top-level heading to the beginning of the file:
|
|
1578
1609
|
|
|
1579
1610
|
```markdown
|
|
1580
1611
|
# File with heading
|
|
1581
1612
|
|
|
1582
|
-
This is a file with a top
|
|
1613
|
+
This is a file with a top-level heading
|
|
1614
|
+
```
|
|
1615
|
+
|
|
1616
|
+
Because it is common for projects on GitHub to use an image for the heading of
|
|
1617
|
+
`README.md` and that is not well-supported by Markdown, HTML headings are also
|
|
1618
|
+
permitted by this rule. For example:
|
|
1619
|
+
|
|
1620
|
+
```markdown
|
|
1621
|
+
<h1 align="center"><img src="https://placekitten.com/300/150"/></h1>
|
|
1622
|
+
|
|
1623
|
+
This is a file with a top-level HTML heading
|
|
1583
1624
|
```
|
|
1584
1625
|
|
|
1585
|
-
Note: The `level` parameter can be used to change the top
|
|
1586
|
-
where
|
|
1626
|
+
Note: The `level` parameter can be used to change the top-level (ex: to h2) in cases
|
|
1627
|
+
where an h1 is added externally.
|
|
1587
1628
|
|
|
1588
|
-
If [YAML](https://en.wikipedia.org/wiki/YAML) front matter is present and
|
|
1589
|
-
`title` property (commonly used with blog posts), this rule will not
|
|
1590
|
-
violation. To use a different property name in front matter,
|
|
1591
|
-
of a regular expression via the `front_matter_title` parameter.
|
|
1592
|
-
use of front matter by this rule, specify `""` for `front_matter_title`.
|
|
1629
|
+
If [YAML](https://en.wikipedia.org/wiki/YAML) front matter is present and
|
|
1630
|
+
contains a `title` property (commonly used with blog posts), this rule will not
|
|
1631
|
+
report a violation. To use a different property name in the front matter,
|
|
1632
|
+
specify the text of a regular expression via the `front_matter_title` parameter.
|
|
1633
|
+
To disable the use of front matter by this rule, specify `""` for `front_matter_title`.
|
|
1593
1634
|
|
|
1594
|
-
Rationale: The top
|
|
1635
|
+
Rationale: The top-level heading often acts as the title of a document. More
|
|
1595
1636
|
information: <https://cirosantilli.com/markdown-style-guide#top-level-header>.
|
|
1596
1637
|
|
|
1597
1638
|
<a name="md042"></a>
|
|
@@ -1672,8 +1713,9 @@ To allow optional headings as with the following structure:
|
|
|
1672
1713
|
### Notes (optional)
|
|
1673
1714
|
```
|
|
1674
1715
|
|
|
1675
|
-
Use the special value `"*"` meaning "
|
|
1676
|
-
|
|
1716
|
+
Use the special value `"*"` meaning "zero or more unspecified headings" or the
|
|
1717
|
+
special value `"+"` meaning "one or more unspecified headings" and set the
|
|
1718
|
+
`headings` parameter to:
|
|
1677
1719
|
|
|
1678
1720
|
```json
|
|
1679
1721
|
[
|
|
@@ -1786,12 +1828,13 @@ In the default configuration this rule reports a violation for the following doc
|
|
|
1786
1828
|
|
|
1787
1829
|
More text.
|
|
1788
1830
|
|
|
1789
|
-
<!-- markdownlint-
|
|
1831
|
+
<!-- markdownlint-restore -->
|
|
1790
1832
|
|
|
1791
|
-
To fix violations of this rule, use a consistent style (either indenting or code
|
|
1833
|
+
To fix violations of this rule, use a consistent style (either indenting or code
|
|
1834
|
+
fences).
|
|
1792
1835
|
|
|
1793
|
-
The specified style can be specific (`fenced`, `indented`) or simply require
|
|
1794
|
-
be consistent within the document (`consistent`).
|
|
1836
|
+
The specified style can be specific (`fenced`, `indented`) or simply require
|
|
1837
|
+
that usage be consistent within the document (`consistent`).
|
|
1795
1838
|
|
|
1796
1839
|
Rationale: Consistent formatting makes it easier to understand a document.
|
|
1797
1840
|
|
|
@@ -1805,9 +1848,10 @@ Aliases: single-trailing-newline
|
|
|
1805
1848
|
|
|
1806
1849
|
Fixable: Most violations can be fixed by tooling
|
|
1807
1850
|
|
|
1808
|
-
This rule is triggered when there is not a single newline character at the end
|
|
1851
|
+
This rule is triggered when there is not a single newline character at the end
|
|
1852
|
+
of a file.
|
|
1809
1853
|
|
|
1810
|
-
|
|
1854
|
+
An example that triggers the rule:
|
|
1811
1855
|
|
|
1812
1856
|
```markdown
|
|
1813
1857
|
# Heading
|
|
@@ -1837,7 +1881,8 @@ Aliases: code-fence-style
|
|
|
1837
1881
|
|
|
1838
1882
|
Parameters: style ("consistent", "tilde", "backtick"; default "consistent")
|
|
1839
1883
|
|
|
1840
|
-
This rule is triggered when the symbols used in the document for fenced code
|
|
1884
|
+
This rule is triggered when the symbols used in the document for fenced code
|
|
1885
|
+
blocks do not match the configured code fence style:
|
|
1841
1886
|
|
|
1842
1887
|
````markdown
|
|
1843
1888
|
```ruby
|
package/helpers/LICENSE
CHANGED