markdownlint 0.37.4 → 0.39.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 +20 -0
- package/CONTRIBUTING.md +2 -3
- package/README.md +175 -87
- package/doc/Rules.md +273 -47
- package/doc/md001.md +14 -0
- package/doc/md009.md +8 -9
- package/doc/md010.md +6 -0
- package/doc/md027.md +8 -0
- package/doc/md029.md +2 -0
- package/doc/md033.md +7 -1
- package/doc/md038.md +23 -11
- package/doc/md041.md +31 -16
- package/doc/md043.md +22 -4
- package/doc/md045.md +9 -1
- package/doc/md051.md +17 -0
- package/doc/md052.md +12 -0
- package/doc/md053.md +3 -3
- package/doc/md055.md +1 -1
- package/doc/md056.md +1 -1
- package/doc/md059.md +33 -0
- package/doc/md060.md +70 -0
- package/helpers/README.md +2 -2
- package/helpers/helpers.cjs +174 -20
- package/helpers/micromark-helpers.cjs +37 -7
- package/helpers/package.json +1 -1
- package/lib/cache.mjs +25 -7
- package/lib/configuration-strict.d.ts +1494 -292
- package/lib/constants.mjs +6 -5
- package/lib/defer-require.cjs +2 -0
- package/lib/exports.d.mts +2 -2
- package/lib/exports.mjs +2 -2
- package/lib/markdownit.cjs +8 -14
- package/lib/markdownlint.d.mts +136 -52
- package/lib/markdownlint.mjs +469 -409
- package/lib/md001.mjs +6 -2
- package/lib/md004.mjs +7 -18
- package/lib/md007.mjs +2 -1
- package/lib/md009.mjs +9 -5
- package/lib/md010.mjs +1 -1
- package/lib/md022.mjs +5 -2
- package/lib/md025.mjs +23 -15
- package/lib/md027.mjs +11 -1
- package/lib/md029.mjs +25 -14
- package/lib/md031.mjs +0 -1
- package/lib/md032.mjs +3 -1
- package/lib/md033.mjs +28 -20
- package/lib/md034.mjs +2 -1
- package/lib/md036.mjs +16 -4
- package/lib/md037.mjs +10 -7
- package/lib/md038.mjs +52 -71
- package/lib/md041.mjs +54 -16
- package/lib/md042.mjs +4 -2
- package/lib/md043.mjs +4 -2
- package/lib/md044.mjs +1 -1
- package/lib/md045.mjs +3 -1
- package/lib/md046.mjs +6 -6
- package/lib/md051.mjs +13 -5
- package/lib/md052.mjs +2 -1
- package/lib/md053.mjs +1 -1
- package/lib/md054.mjs +7 -5
- package/lib/md055.mjs +7 -6
- package/lib/md056.mjs +1 -1
- package/lib/md059.mjs +71 -0
- package/lib/md060.mjs +121 -0
- package/lib/micromark-parse.mjs +17 -3
- package/lib/node-imports-browser.mjs +2 -0
- package/lib/parse-configuration.mjs +47 -0
- package/lib/rules.mjs +5 -1
- package/package.json +32 -30
- package/schema/.markdownlint.jsonc +97 -62
- package/schema/.markdownlint.yaml +86 -57
- package/schema/markdownlint-config-schema-strict.json +4713 -1436
- package/schema/markdownlint-config-schema.json +4713 -1436
package/doc/md033.md
CHANGED
|
@@ -7,6 +7,8 @@ Aliases: `no-inline-html`
|
|
|
7
7
|
Parameters:
|
|
8
8
|
|
|
9
9
|
- `allowed_elements`: Allowed elements (`string[]`, default `[]`)
|
|
10
|
+
- `table_allowed_elements`: Allowed elements in tables (`string[]`, default
|
|
11
|
+
`[]`)
|
|
10
12
|
|
|
11
13
|
This rule is triggered whenever raw HTML is used in a Markdown document:
|
|
12
14
|
|
|
@@ -20,7 +22,11 @@ To fix this, use 'pure' Markdown instead of including raw HTML:
|
|
|
20
22
|
# Markdown heading
|
|
21
23
|
```
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
To allow specific HTML elements anywhere in Markdown content, set the
|
|
26
|
+
`allowed_elements` parameter to a list of HTML element names. To allow a
|
|
27
|
+
specific set of HTML elements within Markdown tables, set the
|
|
28
|
+
`table_allowed_elements` parameter to a list of HTML element names. This can be
|
|
29
|
+
used to permit the use of `<br>`-style line breaks only within Markdown tables.
|
|
24
30
|
|
|
25
31
|
Rationale: Raw HTML is allowed in Markdown, but this rule is included for
|
|
26
32
|
those who want their documents to only include "pure" Markdown, or for those
|
package/doc/md038.md
CHANGED
|
@@ -6,35 +6,47 @@ Aliases: `no-space-in-code`
|
|
|
6
6
|
|
|
7
7
|
Fixable: Some violations can be fixed by tooling
|
|
8
8
|
|
|
9
|
-
This rule is triggered for code
|
|
10
|
-
backticks:
|
|
9
|
+
This rule is triggered for code spans containing content with unnecessary space
|
|
10
|
+
next to the beginning or ending backticks:
|
|
11
11
|
|
|
12
12
|
```markdown
|
|
13
13
|
`some text `
|
|
14
14
|
|
|
15
15
|
` some text`
|
|
16
|
+
|
|
17
|
+
` some text `
|
|
16
18
|
```
|
|
17
19
|
|
|
18
|
-
To fix this, remove
|
|
20
|
+
To fix this, remove the extra space characters from the beginning and ending:
|
|
19
21
|
|
|
20
22
|
```markdown
|
|
21
23
|
`some text`
|
|
22
24
|
```
|
|
23
25
|
|
|
24
|
-
Note: A single leading and trailing space is allowed by the specification and
|
|
25
|
-
|
|
26
|
+
Note: A single leading *and* trailing space is allowed by the specification and
|
|
27
|
+
trimmed by the parser to support code spans that begin or end with a backtick:
|
|
26
28
|
|
|
27
29
|
```markdown
|
|
28
30
|
`` `backticks` ``
|
|
31
|
+
|
|
32
|
+
`` backtick` ``
|
|
29
33
|
```
|
|
30
34
|
|
|
31
|
-
Note:
|
|
32
|
-
|
|
35
|
+
Note: When single-space padding is present in the input, it will be preserved
|
|
36
|
+
(even if unnecessary):
|
|
33
37
|
|
|
34
38
|
```markdown
|
|
35
|
-
|
|
39
|
+
` code `
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Note: Code spans containing only spaces are allowed by the specification and are
|
|
43
|
+
also preserved:
|
|
44
|
+
|
|
45
|
+
```markdown
|
|
46
|
+
` `
|
|
47
|
+
|
|
48
|
+
` `
|
|
36
49
|
```
|
|
37
50
|
|
|
38
|
-
Rationale: Violations of this rule are usually unintentional and
|
|
39
|
-
improperly-rendered content.
|
|
40
|
-
rule can be disabled for that line or file.
|
|
51
|
+
Rationale: Violations of this rule are usually unintentional and can lead to
|
|
52
|
+
improperly-rendered content.
|
package/doc/md041.md
CHANGED
|
@@ -6,44 +6,59 @@ Aliases: `first-line-h1`, `first-line-heading`
|
|
|
6
6
|
|
|
7
7
|
Parameters:
|
|
8
8
|
|
|
9
|
+
- `allow_preamble`: Allow content before first heading (`boolean`, default
|
|
10
|
+
`false`)
|
|
9
11
|
- `front_matter_title`: RegExp for matching title in front matter (`string`,
|
|
10
12
|
default `^\s*title\s*[:=]`)
|
|
11
13
|
- `level`: Heading level (`integer`, default `1`)
|
|
12
14
|
|
|
13
15
|
This rule is intended to ensure documents have a title and is triggered when
|
|
14
|
-
the first line in
|
|
16
|
+
the first line in a document is not a top-level ([HTML][HTML] `h1`) heading:
|
|
15
17
|
|
|
16
18
|
```markdown
|
|
17
|
-
This is a
|
|
19
|
+
This is a document without a heading
|
|
18
20
|
```
|
|
19
21
|
|
|
20
|
-
To fix this, add a top-level heading to the beginning of the
|
|
22
|
+
To fix this, add a top-level heading to the beginning of the document:
|
|
21
23
|
|
|
22
24
|
```markdown
|
|
23
|
-
#
|
|
25
|
+
# Document Heading
|
|
24
26
|
|
|
25
|
-
This is a
|
|
27
|
+
This is a document with a top-level heading
|
|
26
28
|
```
|
|
27
29
|
|
|
28
30
|
Because it is common for projects on GitHub to use an image for the heading of
|
|
29
|
-
`README.md` and that is not well-supported by Markdown, HTML headings
|
|
30
|
-
permitted by this rule. For example:
|
|
31
|
+
`README.md` and that pattern is not well-supported by Markdown, HTML headings
|
|
32
|
+
are also permitted by this rule. For example:
|
|
31
33
|
|
|
32
34
|
```markdown
|
|
33
35
|
<h1 align="center"><img src="https://placekitten.com/300/150"/></h1>
|
|
34
36
|
|
|
35
|
-
This is a
|
|
37
|
+
This is a document with a top-level HTML heading
|
|
36
38
|
```
|
|
37
39
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
In some cases, a document's title heading may be preceded by text like a table
|
|
41
|
+
of contents. This is not ideal for accessibility, but can be allowed by setting
|
|
42
|
+
the `allow_preamble` parameter to `true`.
|
|
40
43
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
```markdown
|
|
45
|
+
This is a document with preamble text
|
|
46
|
+
|
|
47
|
+
# Document Heading
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
If [YAML][YAML] front matter is present and contains a `title` property
|
|
51
|
+
(commonly used with blog posts), this rule will not report a violation. To use a
|
|
52
|
+
different property name in the front matter, specify the text of a [regular
|
|
53
|
+
expression][RegExp] via the `front_matter_title` parameter. To disable the use
|
|
54
|
+
of front matter by this rule, specify `""` for `front_matter_title`.
|
|
55
|
+
|
|
56
|
+
The `level` parameter can be used to change the top-level heading (ex: to `h2`)
|
|
57
|
+
in cases where an `h1` is added externally.
|
|
47
58
|
|
|
48
59
|
Rationale: The top-level heading often acts as the title of a document. More
|
|
49
60
|
information: <https://cirosantilli.com/markdown-style-guide#top-level-header>.
|
|
61
|
+
|
|
62
|
+
[HTML]: https://en.wikipedia.org/wiki/HTML
|
|
63
|
+
[RegExp]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions
|
|
64
|
+
[YAML]: https://en.wikipedia.org/wiki/YAML
|
package/doc/md043.md
CHANGED
|
@@ -16,7 +16,7 @@ structure for a set of files.
|
|
|
16
16
|
To require exactly the following structure:
|
|
17
17
|
|
|
18
18
|
```markdown
|
|
19
|
-
#
|
|
19
|
+
# Heading
|
|
20
20
|
## Item
|
|
21
21
|
### Detail
|
|
22
22
|
```
|
|
@@ -25,7 +25,7 @@ Set the `headings` parameter to:
|
|
|
25
25
|
|
|
26
26
|
```json
|
|
27
27
|
[
|
|
28
|
-
"#
|
|
28
|
+
"# Heading",
|
|
29
29
|
"## Item",
|
|
30
30
|
"### Detail"
|
|
31
31
|
]
|
|
@@ -34,7 +34,7 @@ Set the `headings` parameter to:
|
|
|
34
34
|
To allow optional headings as with the following structure:
|
|
35
35
|
|
|
36
36
|
```markdown
|
|
37
|
-
#
|
|
37
|
+
# Heading
|
|
38
38
|
## Item
|
|
39
39
|
### Detail (optional)
|
|
40
40
|
## Foot
|
|
@@ -47,7 +47,7 @@ special value `"+"` meaning "one or more unspecified headings" and set the
|
|
|
47
47
|
|
|
48
48
|
```json
|
|
49
49
|
[
|
|
50
|
-
"#
|
|
50
|
+
"# Heading",
|
|
51
51
|
"## Item",
|
|
52
52
|
"*",
|
|
53
53
|
"## Foot",
|
|
@@ -55,6 +55,24 @@ special value `"+"` meaning "one or more unspecified headings" and set the
|
|
|
55
55
|
]
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
+
To allow a single required heading to vary as with a project name:
|
|
59
|
+
|
|
60
|
+
```markdown
|
|
61
|
+
# Project Name
|
|
62
|
+
## Description
|
|
63
|
+
## Examples
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Use the special value `"?"` meaning "exactly one unspecified heading":
|
|
67
|
+
|
|
68
|
+
```json
|
|
69
|
+
[
|
|
70
|
+
"?",
|
|
71
|
+
"## Description",
|
|
72
|
+
"## Examples"
|
|
73
|
+
]
|
|
74
|
+
```
|
|
75
|
+
|
|
58
76
|
When an error is detected, this rule outputs the line number of the first
|
|
59
77
|
problematic heading (otherwise, it outputs the last line number of the file).
|
|
60
78
|
|
package/doc/md045.md
CHANGED
|
@@ -4,7 +4,7 @@ Tags: `accessibility`, `images`
|
|
|
4
4
|
|
|
5
5
|
Aliases: `no-alt-text`
|
|
6
6
|
|
|
7
|
-
This rule
|
|
7
|
+
This rule reports a violation when an image is missing alternate text (alt text)
|
|
8
8
|
information.
|
|
9
9
|
|
|
10
10
|
Alternate text is commonly specified inline as:
|
|
@@ -29,12 +29,20 @@ Or with HTML as:
|
|
|
29
29
|
<img src="image.jpg" alt="Alternate text" />
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
+
Note: If the [HTML `aria-hidden` attribute][aria-hidden] is used to hide the
|
|
33
|
+
image from assistive technology, this rule does not report a violation:
|
|
34
|
+
|
|
35
|
+
```html
|
|
36
|
+
<img src="image.jpg" aria-hidden="true" />
|
|
37
|
+
```
|
|
38
|
+
|
|
32
39
|
Guidance for writing alternate text is available from the [W3C][w3c],
|
|
33
40
|
[Wikipedia][wikipedia], and [other locations][phase2technology].
|
|
34
41
|
|
|
35
42
|
Rationale: Alternate text is important for accessibility and describes the
|
|
36
43
|
content of an image for people who may not be able to see it.
|
|
37
44
|
|
|
45
|
+
[aria-hidden]: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-hidden
|
|
38
46
|
[phase2technology]: https://www.phase2technology.com/blog/no-more-excuses
|
|
39
47
|
[w3c]: https://www.w3.org/WAI/alt/
|
|
40
48
|
[wikipedia]: https://en.wikipedia.org/wiki/Alt_attribute
|
package/doc/md051.md
CHANGED
|
@@ -7,6 +7,8 @@ Aliases: `link-fragments`
|
|
|
7
7
|
Parameters:
|
|
8
8
|
|
|
9
9
|
- `ignore_case`: Ignore case of fragments (`boolean`, default `false`)
|
|
10
|
+
- `ignored_pattern`: Pattern for ignoring additional fragments (`string`,
|
|
11
|
+
default ``)
|
|
10
12
|
|
|
11
13
|
Fixable: Some violations can be fixed by tooling
|
|
12
14
|
|
|
@@ -64,6 +66,13 @@ attribute can be used to define a fragment:
|
|
|
64
66
|
An `a` tag can be useful in scenarios where a heading is not appropriate or for
|
|
65
67
|
control over the text of the fragment identifier.
|
|
66
68
|
|
|
69
|
+
[HTML links to `#top` scroll to the top of a document][html-top-fragment]. This
|
|
70
|
+
rule allows that syntax (using lower-case for consistency):
|
|
71
|
+
|
|
72
|
+
```markdown
|
|
73
|
+
[Link](#top)
|
|
74
|
+
```
|
|
75
|
+
|
|
67
76
|
This rule also recognizes the custom fragment syntax used by GitHub to highlight
|
|
68
77
|
[specific content in a document][github-linking-to-content].
|
|
69
78
|
|
|
@@ -79,6 +88,12 @@ And this link to content starting within line 19 running into line 21:
|
|
|
79
88
|
[Link](#L19C5-L21C11)
|
|
80
89
|
```
|
|
81
90
|
|
|
91
|
+
Some Markdown generators dynamically create and insert headings when building
|
|
92
|
+
documents, for example by combining a fixed prefix like `figure-` and an
|
|
93
|
+
incrementing numeric counter. To ignore such generated fragments, set the
|
|
94
|
+
`ignored_pattern` [regular expression][RegEx] parameter to a pattern that
|
|
95
|
+
matches (e.g., `^figure-`).
|
|
96
|
+
|
|
82
97
|
Rationale: [GitHub section links][github-section-links] are created
|
|
83
98
|
automatically for every heading when Markdown content is displayed on GitHub.
|
|
84
99
|
This makes it easy to link directly to different sections within a document.
|
|
@@ -93,3 +108,5 @@ append an incrementing integer as needed for uniqueness.
|
|
|
93
108
|
[github-section-links]: https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#section-links
|
|
94
109
|
[github-heading-algorithm]: https://github.com/gjtorikian/html-pipeline/blob/f13a1534cb650ba17af400d1acd3a22c28004c09/lib/html/pipeline/toc_filter.rb
|
|
95
110
|
[github-linking-to-content]: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-a-permanent-link-to-a-code-snippet#linking-to-markdown#linking-to-markdown
|
|
111
|
+
[html-top-fragment]: https://html.spec.whatwg.org/multipage/browsing-the-web.html#scrolling-to-a-fragment
|
|
112
|
+
[RegEx]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions
|
package/doc/md052.md
CHANGED
|
@@ -6,6 +6,7 @@ Aliases: `reference-links-images`
|
|
|
6
6
|
|
|
7
7
|
Parameters:
|
|
8
8
|
|
|
9
|
+
- `ignored_labels`: Ignored link labels (`string[]`, default `["x"]`)
|
|
9
10
|
- `shortcut_syntax`: Include shortcut syntax (`boolean`, default `false`)
|
|
10
11
|
|
|
11
12
|
Links and images in Markdown can provide the link destination or image source
|
|
@@ -38,3 +39,14 @@ so "shortcut" syntax is ignored by default. To include "shortcut" syntax, set
|
|
|
38
39
|
the `include_shortcut` parameter to `true`. Note that doing so produces warnings
|
|
39
40
|
for *all* text in the document that *could* be a shortcut. If bracketed text is
|
|
40
41
|
intentional, brackets can be escaped with the `\` character: `\[example\]`.
|
|
42
|
+
|
|
43
|
+
If there are link labels that are deliberately unreferenced, they can be ignored
|
|
44
|
+
by setting the `ignored_labels` parameter to the list of strings to ignore. The
|
|
45
|
+
default value of this parameter ignores the checkbox syntax used by
|
|
46
|
+
[GitHub Flavored Markdown task list items][gfm-tasklist]:
|
|
47
|
+
|
|
48
|
+
```markdown
|
|
49
|
+
- [x] Checked task list item
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
[gfm-tasklist]: https://github.github.com/gfm/#task-list-items-extension-
|
package/doc/md053.md
CHANGED
|
@@ -29,9 +29,9 @@ reference has the corresponding label. The "full", "collapsed", and "shortcut"
|
|
|
29
29
|
formats are all supported.
|
|
30
30
|
|
|
31
31
|
If there are reference definitions that are deliberately unreferenced, they can
|
|
32
|
-
be ignored by setting the `ignored_definitions` parameter
|
|
33
|
-
this parameter ignores the following convention
|
|
34
|
-
Markdown:
|
|
32
|
+
be ignored by setting the `ignored_definitions` parameter to the list of strings
|
|
33
|
+
to ignore. The default value of this parameter ignores the following convention
|
|
34
|
+
for adding non-HTML comments to Markdown:
|
|
35
35
|
|
|
36
36
|
```markdown
|
|
37
37
|
[//]: # (This behaves like a comment)
|
package/doc/md055.md
CHANGED
|
@@ -52,4 +52,4 @@ Rationale: Some parsers have difficulty with tables that are missing their
|
|
|
52
52
|
leading or trailing pipe characters. The use of leading/trailing pipes can also
|
|
53
53
|
help provide visual clarity.
|
|
54
54
|
|
|
55
|
-
[gfm-table-055]: https://
|
|
55
|
+
[gfm-table-055]: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/organizing-information-with-tables
|
package/doc/md056.md
CHANGED
|
@@ -34,4 +34,4 @@ of cells or it will not be recognized as a table (per specification).
|
|
|
34
34
|
Rationale: Extra cells in a row are usually not shown, so their data is lost.
|
|
35
35
|
Missing cells in a row create holes in the table and suggest an omission.
|
|
36
36
|
|
|
37
|
-
[gfm-table-056]: https://
|
|
37
|
+
[gfm-table-056]: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/organizing-information-with-tables
|
package/doc/md059.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# `MD059` - Link text should be descriptive
|
|
2
|
+
|
|
3
|
+
Tags: `accessibility`, `links`
|
|
4
|
+
|
|
5
|
+
Aliases: `descriptive-link-text`
|
|
6
|
+
|
|
7
|
+
Parameters:
|
|
8
|
+
|
|
9
|
+
- `prohibited_texts`: Prohibited link texts (`string[]`, default `["click
|
|
10
|
+
here","here","link","more"]`)
|
|
11
|
+
|
|
12
|
+
This rule is triggered when a link has generic text like `[click here](...)` or
|
|
13
|
+
`[link](...)`.
|
|
14
|
+
|
|
15
|
+
Link text should be descriptive and communicate the purpose of the link (e.g.,
|
|
16
|
+
`[Download the budget document](...)` or `[CommonMark Specification](...)`).
|
|
17
|
+
This is especially important for screen readers which sometimes present links
|
|
18
|
+
without context.
|
|
19
|
+
|
|
20
|
+
By default, this rule prohibits a small number of common English words/phrases.
|
|
21
|
+
To customize that list of words/phrases, set the `prohibited_texts` parameter to
|
|
22
|
+
an `Array` of `string`s.
|
|
23
|
+
|
|
24
|
+
Note: For languages other than English, use the `prohibited_texts` parameter to
|
|
25
|
+
customize the list for that language. It is *not* a goal for this rule to have
|
|
26
|
+
translations for every language.
|
|
27
|
+
|
|
28
|
+
Note: This rule checks Markdown links; HTML links are ignored.
|
|
29
|
+
|
|
30
|
+
More information:
|
|
31
|
+
|
|
32
|
+
- <https://webaim.org/techniques/hypertext/>
|
|
33
|
+
- <https://www.w3.org/WAI/WCAG21/Understanding/link-purpose-link-only.html>
|
package/doc/md060.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# `MD060` - Table column style
|
|
2
|
+
|
|
3
|
+
Tags: `table`
|
|
4
|
+
|
|
5
|
+
Aliases: `table-column-style`
|
|
6
|
+
|
|
7
|
+
Parameters:
|
|
8
|
+
|
|
9
|
+
- `style`: Table column style (`string`, default `any`, values `aligned` /
|
|
10
|
+
`any` / `compact` / `tight`)
|
|
11
|
+
|
|
12
|
+
This rule is triggered when the column separators of a
|
|
13
|
+
[GitHub Flavored Markdown table][gfm-table-060] are used inconsistently.
|
|
14
|
+
|
|
15
|
+
This rule recognizes three table column styles based on popular use:
|
|
16
|
+
|
|
17
|
+
Style `aligned` looks the most like a table:
|
|
18
|
+
|
|
19
|
+
```markdown
|
|
20
|
+
| Character | Meaning |
|
|
21
|
+
| --------- | ------- |
|
|
22
|
+
| Y | Yes |
|
|
23
|
+
| N | No |
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Style `compact` uses a single space to pad cell content:
|
|
27
|
+
|
|
28
|
+
```markdown
|
|
29
|
+
| Character | Meaning |
|
|
30
|
+
| --- | --- |
|
|
31
|
+
| Y | Yes |
|
|
32
|
+
| N | No |
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Style `tight` uses no padding for cell content:
|
|
36
|
+
|
|
37
|
+
```markdown
|
|
38
|
+
|Character|Meaning|
|
|
39
|
+
|---|---|
|
|
40
|
+
|Y|Yes|
|
|
41
|
+
|N|No|
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
When this rule's `style` parameter is set to `aligned`, `compact`, or `tight`,
|
|
45
|
+
every table must match the corresponding pattern and errors will be reported for
|
|
46
|
+
any violations. By default, or when the `any` style is used, each table is
|
|
47
|
+
analyzed to see if it satisfies any supported style. If so, no errors are
|
|
48
|
+
reported. If not, errors are be reported for whichever style would produce the
|
|
49
|
+
*fewest* errors (i.e., whichever style is the closest match).
|
|
50
|
+
|
|
51
|
+
Note: Pipe alignment for the `aligned` style is based on character count, so
|
|
52
|
+
wide characters and multi-character encodings can produce unexpected results.
|
|
53
|
+
The following table is correctly aligned based on character count, though some
|
|
54
|
+
editors render the emoji wider:
|
|
55
|
+
|
|
56
|
+
<!-- markdownlint-capture -->
|
|
57
|
+
<!-- markdownlint-disable extended-ascii -->
|
|
58
|
+
|
|
59
|
+
```markdown
|
|
60
|
+
| Response | Emoji |
|
|
61
|
+
| -------- | ----- |
|
|
62
|
+
| Yes | ✅ |
|
|
63
|
+
| No | ❎ |
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
<!-- markdownlint-restore -->
|
|
67
|
+
|
|
68
|
+
Rationale: Consistent formatting makes it easier to understand a document.
|
|
69
|
+
|
|
70
|
+
[gfm-table-060]: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/organizing-information-with-tables
|
package/helpers/README.md
CHANGED
|
@@ -22,8 +22,8 @@ be useful to custom rule authors and may avoid duplicating code.
|
|
|
22
22
|
*None* - The entire body of code is tested to 100% coverage by the core
|
|
23
23
|
`markdownlint` project, so there are no additional tests here.
|
|
24
24
|
|
|
25
|
-
[custom-rules]: https://github.com/DavidAnson/markdownlint/blob/v0.
|
|
25
|
+
[custom-rules]: https://github.com/DavidAnson/markdownlint/blob/v0.39.0/doc/CustomRules.md
|
|
26
26
|
[jsdoc]: https://en.m.wikipedia.org/wiki/JSDoc
|
|
27
27
|
[markdown]: https://en.wikipedia.org/wiki/Markdown
|
|
28
28
|
[markdownlint]: https://github.com/DavidAnson/markdownlint
|
|
29
|
-
[rules]: https://github.com/DavidAnson/markdownlint/blob/v0.
|
|
29
|
+
[rules]: https://github.com/DavidAnson/markdownlint/blob/v0.39.0/doc/Rules.md
|