markdownlint 0.31.1 → 0.32.1
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 +15 -0
- package/CONTRIBUTING.md +2 -2
- package/README.md +19 -28
- package/demo/markdownlint-browser.js +521 -352
- package/doc/Rules.md +146 -127
- package/doc/md001.md +2 -2
- package/doc/md003.md +2 -2
- package/doc/md007.md +3 -4
- package/doc/md013.md +0 -3
- package/doc/md018.md +1 -1
- package/doc/md019.md +1 -1
- package/doc/md020.md +1 -1
- package/doc/md021.md +1 -1
- package/doc/md022.md +2 -2
- package/doc/md023.md +9 -2
- package/doc/md024.md +2 -2
- package/doc/md025.md +1 -1
- package/doc/md026.md +1 -1
- package/doc/md036.md +2 -2
- package/doc/md041.md +1 -1
- package/doc/md043.md +2 -5
- package/doc/md045.md +6 -0
- package/doc/md049.md +1 -1
- package/doc/md050.md +1 -1
- package/doc/md053.md +3 -3
- package/doc/md054.md +100 -0
- package/helpers/helpers.js +27 -7
- package/helpers/micromark.cjs +62 -15
- package/helpers/package.json +2 -1
- package/helpers/shared.js +3 -0
- package/lib/configuration.d.ts +1152 -0
- package/lib/constants.js +7 -7
- package/lib/markdownlint.d.ts +2 -4
- package/lib/markdownlint.js +9 -8
- package/lib/md001.js +2 -2
- package/lib/md003.js +2 -2
- package/lib/md005.js +21 -17
- package/lib/md007.js +62 -25
- package/lib/md013.js +1 -4
- 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/md022.js +4 -4
- package/lib/md023.js +2 -2
- package/lib/md024.js +2 -2
- package/lib/md025.js +1 -1
- package/lib/md026.js +1 -1
- package/lib/md030.js +33 -22
- package/lib/md032.js +1 -4
- package/lib/md033.js +1 -3
- package/lib/md034.js +31 -25
- package/lib/md036.js +2 -2
- package/lib/md037.js +2 -2
- package/lib/md038.js +7 -5
- package/lib/md041.js +1 -1
- package/lib/md043.js +3 -3
- package/lib/md045.js +33 -3
- package/lib/md049-md050.js +2 -2
- package/lib/md051.js +8 -6
- package/lib/md053.js +1 -1
- package/lib/md054.js +125 -0
- package/lib/rules.js +5 -3
- package/package.json +18 -16
- package/schema/.markdownlint.jsonc +63 -60
- package/schema/.markdownlint.yaml +62 -59
- package/schema/markdownlint-config-schema.json +840 -186
- package/style/relaxed.json +0 -1
- package/doc/md002.md +0 -37
- package/doc/md006.md +0 -46
- package/lib/md002.js +0 -22
- package/lib/md006.js +0 -34
package/style/relaxed.json
CHANGED
package/doc/md002.md
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# ~~`MD002` - First heading should be a top-level heading~~
|
|
2
|
-
|
|
3
|
-
> This rule is deprecated and provided for backward-compatibility
|
|
4
|
-
|
|
5
|
-
Tags: `headers`, `headings`
|
|
6
|
-
|
|
7
|
-
Aliases: `first-header-h1`, `first-heading-h1`
|
|
8
|
-
|
|
9
|
-
Parameters:
|
|
10
|
-
|
|
11
|
-
- `level`: Heading level (`integer`, default `1`)
|
|
12
|
-
|
|
13
|
-
> Note: *MD002 has been deprecated and is disabled by default.*
|
|
14
|
-
> [MD041/first-line-heading](md041.md) offers an improved implementation.
|
|
15
|
-
|
|
16
|
-
This rule is intended to ensure document headings start at the top level and
|
|
17
|
-
is triggered when the first heading in the document isn't an h1 heading:
|
|
18
|
-
|
|
19
|
-
```markdown
|
|
20
|
-
## This isn't an H1 heading
|
|
21
|
-
|
|
22
|
-
### Another heading
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
The first heading in the document should be an h1 heading:
|
|
26
|
-
|
|
27
|
-
```markdown
|
|
28
|
-
# Start with an H1 heading
|
|
29
|
-
|
|
30
|
-
## Then use an H2 for subsections
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
Note: The `level` parameter can be used to change the top-level (ex: to h2) in
|
|
34
|
-
cases where an h1 is added externally.
|
|
35
|
-
|
|
36
|
-
Rationale: The top-level heading often acts as the title of a document. More
|
|
37
|
-
information: <https://cirosantilli.com/markdown-style-guide#top-level-header>.
|
package/doc/md006.md
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
# ~~`MD006` - Consider starting bulleted lists at the beginning of the line~~
|
|
2
|
-
|
|
3
|
-
> This rule is deprecated and provided for backward-compatibility
|
|
4
|
-
|
|
5
|
-
Tags: `bullet`, `indentation`, `ul`
|
|
6
|
-
|
|
7
|
-
Aliases: `ul-start-left`
|
|
8
|
-
|
|
9
|
-
Fixable: Some violations can be fixed by tooling
|
|
10
|
-
|
|
11
|
-
This rule is triggered when top-level lists don't start at the beginning of a
|
|
12
|
-
line:
|
|
13
|
-
|
|
14
|
-
```markdown
|
|
15
|
-
Some text
|
|
16
|
-
|
|
17
|
-
* List item
|
|
18
|
-
* List item
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
To fix, ensure that top-level list items are not indented:
|
|
22
|
-
|
|
23
|
-
```markdown
|
|
24
|
-
Some test
|
|
25
|
-
|
|
26
|
-
* List item
|
|
27
|
-
* List item
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
Note: This rule is triggered for the following scenario because the unordered
|
|
31
|
-
sublist is not recognized as such by the parser. Not being nested 3 characters
|
|
32
|
-
as required by the outer ordered list, it creates a top-level unordered list
|
|
33
|
-
instead.
|
|
34
|
-
|
|
35
|
-
```markdown
|
|
36
|
-
1. List item
|
|
37
|
-
- List item
|
|
38
|
-
- List item
|
|
39
|
-
1. List item
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
Rationale: Starting lists at the beginning of the line means that nested list
|
|
43
|
-
items can all be indented by the same amount when an editor's indent function
|
|
44
|
-
or the tab key is used to indent. Starting a list 1 space in means that the
|
|
45
|
-
indent of the first nested list is less than the indent of the second level (3
|
|
46
|
-
characters if you use 4 space tabs, or 1 character if you use 2 space tabs).
|
package/lib/md002.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
"use strict";
|
|
4
|
-
|
|
5
|
-
const { addErrorDetailIf } = require("../helpers");
|
|
6
|
-
|
|
7
|
-
module.exports = {
|
|
8
|
-
"names": [ "MD002", "first-heading-h1", "first-header-h1" ],
|
|
9
|
-
"description": "First heading should be a top-level heading",
|
|
10
|
-
"tags": [ "headings", "headers" ],
|
|
11
|
-
"function": function MD002(params, onError) {
|
|
12
|
-
const level = Number(params.config.level || 1);
|
|
13
|
-
const tag = "h" + level;
|
|
14
|
-
params.parsers.markdownit.tokens.every(function forToken(token) {
|
|
15
|
-
if (token.type === "heading_open") {
|
|
16
|
-
addErrorDetailIf(onError, token.lineNumber, tag, token.tag);
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
return true;
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
};
|
package/lib/md006.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
"use strict";
|
|
4
|
-
|
|
5
|
-
const { addErrorDetailIf, listItemMarkerRe, rangeFromRegExp } =
|
|
6
|
-
require("../helpers");
|
|
7
|
-
const { flattenedLists } = require("./cache");
|
|
8
|
-
|
|
9
|
-
module.exports = {
|
|
10
|
-
"names": [ "MD006", "ul-start-left" ],
|
|
11
|
-
"description":
|
|
12
|
-
"Consider starting bulleted lists at the beginning of the line",
|
|
13
|
-
"tags": [ "bullet", "ul", "indentation" ],
|
|
14
|
-
"function": function MD006(params, onError) {
|
|
15
|
-
for (const list of flattenedLists()) {
|
|
16
|
-
if (list.unordered && !list.nesting && (list.indent !== 0)) {
|
|
17
|
-
for (const item of list.items) {
|
|
18
|
-
const { lineNumber, line } = item;
|
|
19
|
-
addErrorDetailIf(
|
|
20
|
-
onError,
|
|
21
|
-
lineNumber,
|
|
22
|
-
0,
|
|
23
|
-
list.indent,
|
|
24
|
-
null,
|
|
25
|
-
null,
|
|
26
|
-
rangeFromRegExp(line, listItemMarkerRe),
|
|
27
|
-
{
|
|
28
|
-
"deleteCount": line.length - line.trimStart().length
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
};
|