mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 05:50:13 +01:00
Update MD025/single-title to ignore preceding blank lines and comments when looking for a title (top-level heading) (fixes #1420).
This commit is contained in:
parent
cb39972d9b
commit
5fc91f6977
6 changed files with 123 additions and 15 deletions
|
|
@ -0,0 +1,6 @@
|
|||
|
||||
<!-- Comment -->
|
||||
|
||||
# Heading 1
|
||||
|
||||
# Heading 2 {MD025}
|
||||
4
test/heading-multiple-top-level-preceding-blank.md
Normal file
4
test/heading-multiple-top-level-preceding-blank.md
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
|
||||
# Heading 1
|
||||
|
||||
# Heading 2 {MD025}
|
||||
4
test/heading-multiple-top-level-preceding-comment.md
Normal file
4
test/heading-multiple-top-level-preceding-comment.md
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<!-- Comment -->
|
||||
# Heading 1
|
||||
|
||||
# Heading 2 {MD025}
|
||||
|
|
@ -15750,6 +15750,92 @@ Generated by [AVA](https://avajs.dev).
|
|||
`,
|
||||
}
|
||||
|
||||
## heading-multiple-top-level-preceding-blank-and-comment.md
|
||||
|
||||
> Snapshot 1
|
||||
|
||||
{
|
||||
errors: [
|
||||
{
|
||||
errorContext: 'Heading 2 {MD025}',
|
||||
errorDetail: null,
|
||||
errorRange: null,
|
||||
fixInfo: null,
|
||||
lineNumber: 6,
|
||||
ruleDescription: 'Multiple top-level headings in the same document',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md025.md',
|
||||
ruleNames: [
|
||||
'MD025',
|
||||
'single-title',
|
||||
'single-h1',
|
||||
],
|
||||
},
|
||||
],
|
||||
fixed: `␊
|
||||
<!-- Comment -->␊
|
||||
␊
|
||||
# Heading 1␊
|
||||
␊
|
||||
# Heading 2 {MD025}␊
|
||||
`,
|
||||
}
|
||||
|
||||
## heading-multiple-top-level-preceding-blank.md
|
||||
|
||||
> Snapshot 1
|
||||
|
||||
{
|
||||
errors: [
|
||||
{
|
||||
errorContext: 'Heading 2 {MD025}',
|
||||
errorDetail: null,
|
||||
errorRange: null,
|
||||
fixInfo: null,
|
||||
lineNumber: 4,
|
||||
ruleDescription: 'Multiple top-level headings in the same document',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md025.md',
|
||||
ruleNames: [
|
||||
'MD025',
|
||||
'single-title',
|
||||
'single-h1',
|
||||
],
|
||||
},
|
||||
],
|
||||
fixed: `␊
|
||||
# Heading 1␊
|
||||
␊
|
||||
# Heading 2 {MD025}␊
|
||||
`,
|
||||
}
|
||||
|
||||
## heading-multiple-top-level-preceding-comment.md
|
||||
|
||||
> Snapshot 1
|
||||
|
||||
{
|
||||
errors: [
|
||||
{
|
||||
errorContext: 'Heading 2 {MD025}',
|
||||
errorDetail: null,
|
||||
errorRange: null,
|
||||
fixInfo: null,
|
||||
lineNumber: 4,
|
||||
ruleDescription: 'Multiple top-level headings in the same document',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md025.md',
|
||||
ruleNames: [
|
||||
'MD025',
|
||||
'single-title',
|
||||
'single-h1',
|
||||
],
|
||||
},
|
||||
],
|
||||
fixed: `<!-- Comment -->␊
|
||||
# Heading 1␊
|
||||
␊
|
||||
# Heading 2 {MD025}␊
|
||||
`,
|
||||
}
|
||||
|
||||
## heading_duplicate_content.md
|
||||
|
||||
> Snapshot 1
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue