mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 05:50:13 +01:00
Update MD041/first-line-heading to add an allow_preamble parameter (fixes #1416).
This commit is contained in:
parent
c061888937
commit
62dc79864d
17 changed files with 538 additions and 163 deletions
22
test/first-line-heading-allow-preamble-false.md
Normal file
22
test/first-line-heading-allow-preamble-false.md
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
Text {MD041}
|
||||
|
||||
<!-- Comment -->
|
||||
|
||||
Text
|
||||
|
||||
<p>HTML</p>
|
||||
|
||||
Text
|
||||
|
||||
- List item
|
||||
|
||||
# Heading
|
||||
|
||||
Text
|
||||
|
||||
<!-- markdownlint-configure-file {
|
||||
"first-line-heading": {
|
||||
"allow_preamble": false
|
||||
},
|
||||
"no-inline-html": false
|
||||
} -->
|
||||
22
test/first-line-heading-allow-preamble-h1.md
Normal file
22
test/first-line-heading-allow-preamble-h1.md
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
Text
|
||||
|
||||
<!-- Comment -->
|
||||
|
||||
Text
|
||||
|
||||
<p>HTML</p>
|
||||
|
||||
Text
|
||||
|
||||
- List item
|
||||
|
||||
<h1>Heading</h1>
|
||||
|
||||
Text
|
||||
|
||||
<!-- markdownlint-configure-file {
|
||||
"first-line-heading": {
|
||||
"allow_preamble": true
|
||||
},
|
||||
"no-inline-html": false
|
||||
} -->
|
||||
22
test/first-line-heading-allow-preamble-violation.md
Normal file
22
test/first-line-heading-allow-preamble-violation.md
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
Text
|
||||
|
||||
<!-- Comment -->
|
||||
|
||||
Text
|
||||
|
||||
<p>HTML</p>
|
||||
|
||||
Text
|
||||
|
||||
- List item
|
||||
|
||||
## Heading {MD041}
|
||||
|
||||
Text
|
||||
|
||||
<!-- markdownlint-configure-file {
|
||||
"first-line-heading": {
|
||||
"allow_preamble": true
|
||||
},
|
||||
"no-inline-html": false
|
||||
} -->
|
||||
22
test/first-line-heading-allow-preamble.md
Normal file
22
test/first-line-heading-allow-preamble.md
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
Text
|
||||
|
||||
<!-- Comment -->
|
||||
|
||||
Text
|
||||
|
||||
<p>HTML</p>
|
||||
|
||||
Text
|
||||
|
||||
- List item
|
||||
|
||||
# Heading
|
||||
|
||||
Text
|
||||
|
||||
<!-- markdownlint-configure-file {
|
||||
"first-line-heading": {
|
||||
"allow_preamble": true
|
||||
},
|
||||
"no-inline-html": false
|
||||
} -->
|
||||
|
|
@ -907,7 +907,7 @@ test("readme", async(t) => {
|
|||
});
|
||||
|
||||
test("validateJsonUsingConfigSchemaStrict", async(t) => {
|
||||
t.plan(192);
|
||||
t.plan(196);
|
||||
// @ts-ignore
|
||||
const ajv = new Ajv(ajvOptions);
|
||||
const validateSchemaStrict = ajv.compile(configSchemaStrict);
|
||||
|
|
|
|||
|
|
@ -13752,6 +13752,160 @@ Generated by [AVA](https://avajs.dev).
|
|||
`,
|
||||
}
|
||||
|
||||
## first-line-heading-allow-preamble-false.md
|
||||
|
||||
> Snapshot 1
|
||||
|
||||
{
|
||||
errors: [
|
||||
{
|
||||
errorContext: 'Text {MD041}',
|
||||
errorDetail: null,
|
||||
errorRange: null,
|
||||
fixInfo: null,
|
||||
lineNumber: 1,
|
||||
ruleDescription: 'First line in a file should be a top-level heading',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md041.md',
|
||||
ruleNames: [
|
||||
'MD041',
|
||||
'first-line-heading',
|
||||
'first-line-h1',
|
||||
],
|
||||
},
|
||||
],
|
||||
fixed: `Text {MD041}␊
|
||||
␊
|
||||
<!-- Comment -->␊
|
||||
␊
|
||||
Text␊
|
||||
␊
|
||||
<p>HTML</p>␊
|
||||
␊
|
||||
Text␊
|
||||
␊
|
||||
- List item␊
|
||||
␊
|
||||
# Heading␊
|
||||
␊
|
||||
Text␊
|
||||
␊
|
||||
<!-- markdownlint-configure-file {␊
|
||||
"first-line-heading": {␊
|
||||
"allow_preamble": false␊
|
||||
},␊
|
||||
"no-inline-html": false␊
|
||||
} -->␊
|
||||
`,
|
||||
}
|
||||
|
||||
## first-line-heading-allow-preamble-h1.md
|
||||
|
||||
> Snapshot 1
|
||||
|
||||
{
|
||||
errors: [],
|
||||
fixed: `Text␊
|
||||
␊
|
||||
<!-- Comment -->␊
|
||||
␊
|
||||
Text␊
|
||||
␊
|
||||
<p>HTML</p>␊
|
||||
␊
|
||||
Text␊
|
||||
␊
|
||||
- List item␊
|
||||
␊
|
||||
<h1>Heading</h1>␊
|
||||
␊
|
||||
Text␊
|
||||
␊
|
||||
<!-- markdownlint-configure-file {␊
|
||||
"first-line-heading": {␊
|
||||
"allow_preamble": true␊
|
||||
},␊
|
||||
"no-inline-html": false␊
|
||||
} -->␊
|
||||
`,
|
||||
}
|
||||
|
||||
## first-line-heading-allow-preamble-violation.md
|
||||
|
||||
> Snapshot 1
|
||||
|
||||
{
|
||||
errors: [
|
||||
{
|
||||
errorContext: '## Heading {MD041}',
|
||||
errorDetail: null,
|
||||
errorRange: null,
|
||||
fixInfo: null,
|
||||
lineNumber: 13,
|
||||
ruleDescription: 'First line in a file should be a top-level heading',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md041.md',
|
||||
ruleNames: [
|
||||
'MD041',
|
||||
'first-line-heading',
|
||||
'first-line-h1',
|
||||
],
|
||||
},
|
||||
],
|
||||
fixed: `Text␊
|
||||
␊
|
||||
<!-- Comment -->␊
|
||||
␊
|
||||
Text␊
|
||||
␊
|
||||
<p>HTML</p>␊
|
||||
␊
|
||||
Text␊
|
||||
␊
|
||||
- List item␊
|
||||
␊
|
||||
## Heading {MD041}␊
|
||||
␊
|
||||
Text␊
|
||||
␊
|
||||
<!-- markdownlint-configure-file {␊
|
||||
"first-line-heading": {␊
|
||||
"allow_preamble": true␊
|
||||
},␊
|
||||
"no-inline-html": false␊
|
||||
} -->␊
|
||||
`,
|
||||
}
|
||||
|
||||
## first-line-heading-allow-preamble.md
|
||||
|
||||
> Snapshot 1
|
||||
|
||||
{
|
||||
errors: [],
|
||||
fixed: `Text␊
|
||||
␊
|
||||
<!-- Comment -->␊
|
||||
␊
|
||||
Text␊
|
||||
␊
|
||||
<p>HTML</p>␊
|
||||
␊
|
||||
Text␊
|
||||
␊
|
||||
- List item␊
|
||||
␊
|
||||
# Heading␊
|
||||
␊
|
||||
Text␊
|
||||
␊
|
||||
<!-- markdownlint-configure-file {␊
|
||||
"first-line-heading": {␊
|
||||
"allow_preamble": true␊
|
||||
},␊
|
||||
"no-inline-html": false␊
|
||||
} -->␊
|
||||
`,
|
||||
}
|
||||
|
||||
## first_heading_bad_atx.md
|
||||
|
||||
> Snapshot 1
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue