mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 05:50:13 +01:00
Update MD043/required-headings to support "?" meaning "exactly one unspecified heading" (fixes #475).
This commit is contained in:
parent
06b60b7372
commit
5749c8dcf7
15 changed files with 297 additions and 18 deletions
|
|
@ -907,7 +907,7 @@ test("readme", async(t) => {
|
|||
});
|
||||
|
||||
test("validateJsonUsingConfigSchemaStrict", async(t) => {
|
||||
t.plan(187);
|
||||
t.plan(192);
|
||||
// @ts-ignore
|
||||
const ajv = new Ajv(ajvOptions);
|
||||
const validateSchemaStrict = ajv.compile(configSchemaStrict);
|
||||
|
|
|
|||
15
test/required-headings-question-extra.md
Normal file
15
test/required-headings-question-extra.md
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# Project Name
|
||||
|
||||
## Description
|
||||
|
||||
<!-- markdownlint-configure-file {
|
||||
"required-headings": {
|
||||
"headings": [
|
||||
"# Project Name",
|
||||
"## Description",
|
||||
"?"
|
||||
]
|
||||
}
|
||||
} -->
|
||||
|
||||
{MD043:+1}
|
||||
15
test/required-headings-question-first.md
Normal file
15
test/required-headings-question-first.md
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# Project Name
|
||||
|
||||
## Description
|
||||
|
||||
## Examples
|
||||
|
||||
<!-- markdownlint-configure-file {
|
||||
"required-headings": {
|
||||
"headings": [
|
||||
"?",
|
||||
"## Description",
|
||||
"## Examples"
|
||||
]
|
||||
}
|
||||
} -->
|
||||
15
test/required-headings-question-last.md
Normal file
15
test/required-headings-question-last.md
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# Project Name
|
||||
|
||||
## Description
|
||||
|
||||
## Examples
|
||||
|
||||
<!-- markdownlint-configure-file {
|
||||
"required-headings": {
|
||||
"headings": [
|
||||
"# Project Name",
|
||||
"## Description",
|
||||
"?"
|
||||
]
|
||||
}
|
||||
} -->
|
||||
15
test/required-headings-question-middle.md
Normal file
15
test/required-headings-question-middle.md
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# Project Name
|
||||
|
||||
## Description
|
||||
|
||||
## Examples
|
||||
|
||||
<!-- markdownlint-configure-file {
|
||||
"required-headings": {
|
||||
"headings": [
|
||||
"# Project Name",
|
||||
"?",
|
||||
"## Examples"
|
||||
]
|
||||
}
|
||||
} -->
|
||||
15
test/required-headings-question-missing.md
Normal file
15
test/required-headings-question-missing.md
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# Project Name
|
||||
|
||||
## Examples
|
||||
|
||||
<!-- markdownlint-configure-file {
|
||||
"required-headings": {
|
||||
"headings": [
|
||||
"# Project Name",
|
||||
"?",
|
||||
"## Examples"
|
||||
]
|
||||
}
|
||||
} -->
|
||||
|
||||
{MD043:+1}
|
||||
|
|
@ -48588,6 +48588,154 @@ Generated by [AVA](https://avajs.dev).
|
|||
`,
|
||||
}
|
||||
|
||||
## required-headings-question-extra.md
|
||||
|
||||
> Snapshot 1
|
||||
|
||||
{
|
||||
errors: [
|
||||
{
|
||||
errorContext: '?',
|
||||
errorDetail: null,
|
||||
errorRange: null,
|
||||
fixInfo: null,
|
||||
lineNumber: 16,
|
||||
ruleDescription: 'Required heading structure',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md043.md',
|
||||
ruleNames: [
|
||||
'MD043',
|
||||
'required-headings',
|
||||
],
|
||||
},
|
||||
],
|
||||
fixed: `# Project Name␊
|
||||
␊
|
||||
## Description␊
|
||||
␊
|
||||
<!-- markdownlint-configure-file {␊
|
||||
"required-headings": {␊
|
||||
"headings": [␊
|
||||
"# Project Name",␊
|
||||
"## Description",␊
|
||||
"?"␊
|
||||
]␊
|
||||
}␊
|
||||
} -->␊
|
||||
␊
|
||||
{MD043:+1}␊
|
||||
`,
|
||||
}
|
||||
|
||||
## required-headings-question-first.md
|
||||
|
||||
> Snapshot 1
|
||||
|
||||
{
|
||||
errors: [],
|
||||
fixed: `# Project Name␊
|
||||
␊
|
||||
## Description␊
|
||||
␊
|
||||
## Examples␊
|
||||
␊
|
||||
<!-- markdownlint-configure-file {␊
|
||||
"required-headings": {␊
|
||||
"headings": [␊
|
||||
"?",␊
|
||||
"## Description",␊
|
||||
"## Examples"␊
|
||||
]␊
|
||||
}␊
|
||||
} -->␊
|
||||
`,
|
||||
}
|
||||
|
||||
## required-headings-question-last.md
|
||||
|
||||
> Snapshot 1
|
||||
|
||||
{
|
||||
errors: [],
|
||||
fixed: `# Project Name␊
|
||||
␊
|
||||
## Description␊
|
||||
␊
|
||||
## Examples␊
|
||||
␊
|
||||
<!-- markdownlint-configure-file {␊
|
||||
"required-headings": {␊
|
||||
"headings": [␊
|
||||
"# Project Name",␊
|
||||
"## Description",␊
|
||||
"?"␊
|
||||
]␊
|
||||
}␊
|
||||
} -->␊
|
||||
`,
|
||||
}
|
||||
|
||||
## required-headings-question-middle.md
|
||||
|
||||
> Snapshot 1
|
||||
|
||||
{
|
||||
errors: [],
|
||||
fixed: `# Project Name␊
|
||||
␊
|
||||
## Description␊
|
||||
␊
|
||||
## Examples␊
|
||||
␊
|
||||
<!-- markdownlint-configure-file {␊
|
||||
"required-headings": {␊
|
||||
"headings": [␊
|
||||
"# Project Name",␊
|
||||
"?",␊
|
||||
"## Examples"␊
|
||||
]␊
|
||||
}␊
|
||||
} -->␊
|
||||
`,
|
||||
}
|
||||
|
||||
## required-headings-question-missing.md
|
||||
|
||||
> Snapshot 1
|
||||
|
||||
{
|
||||
errors: [
|
||||
{
|
||||
errorContext: '## Examples',
|
||||
errorDetail: null,
|
||||
errorRange: null,
|
||||
fixInfo: null,
|
||||
lineNumber: 16,
|
||||
ruleDescription: 'Required heading structure',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md043.md',
|
||||
ruleNames: [
|
||||
'MD043',
|
||||
'required-headings',
|
||||
],
|
||||
},
|
||||
],
|
||||
fixed: `# Project Name␊
|
||||
␊
|
||||
## Examples␊
|
||||
␊
|
||||
<!-- markdownlint-configure-file {␊
|
||||
"required-headings": {␊
|
||||
"headings": [␊
|
||||
"# Project Name",␊
|
||||
"?",␊
|
||||
"## Examples"␊
|
||||
]␊
|
||||
}␊
|
||||
} -->␊
|
||||
␊
|
||||
{MD043:+1}␊
|
||||
`,
|
||||
}
|
||||
|
||||
## required-headings-wrong-match-case.md
|
||||
|
||||
> Snapshot 1
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue