mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 14:00: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
|
|
@ -118,10 +118,10 @@
|
|||
|
||||
// MD025/single-title/single-h1 : Multiple top-level headings in the same document : https://github.com/DavidAnson/markdownlint/blob/v0.37.4/doc/md025.md
|
||||
"MD025": {
|
||||
// Heading level
|
||||
"level": 1,
|
||||
// RegExp for matching title in front matter
|
||||
"front_matter_title": "^\\s*title\\s*[:=]"
|
||||
"front_matter_title": "^\\s*title\\s*[:=]",
|
||||
// Heading level
|
||||
"level": 1
|
||||
},
|
||||
|
||||
// MD026/no-trailing-punctuation : Trailing punctuation in heading : https://github.com/DavidAnson/markdownlint/blob/v0.37.4/doc/md026.md
|
||||
|
|
@ -206,10 +206,12 @@
|
|||
|
||||
// MD041/first-line-heading/first-line-h1 : First line in a file should be a top-level heading : https://github.com/DavidAnson/markdownlint/blob/v0.37.4/doc/md041.md
|
||||
"MD041": {
|
||||
// Heading level
|
||||
"level": 1,
|
||||
// Allow content before first heading
|
||||
"allow_preamble": false,
|
||||
// RegExp for matching title in front matter
|
||||
"front_matter_title": "^\\s*title\\s*[:=]"
|
||||
"front_matter_title": "^\\s*title\\s*[:=]",
|
||||
// Heading level
|
||||
"level": 1
|
||||
},
|
||||
|
||||
// MD042/no-empty-links : No empty links : https://github.com/DavidAnson/markdownlint/blob/v0.37.4/doc/md042.md
|
||||
|
|
|
|||
|
|
@ -108,10 +108,10 @@ MD024:
|
|||
|
||||
# MD025/single-title/single-h1 : Multiple top-level headings in the same document : https://github.com/DavidAnson/markdownlint/blob/v0.37.4/doc/md025.md
|
||||
MD025:
|
||||
# Heading level
|
||||
level: 1
|
||||
# RegExp for matching title in front matter
|
||||
front_matter_title: "^\\s*title\\s*[:=]"
|
||||
# Heading level
|
||||
level: 1
|
||||
|
||||
# MD026/no-trailing-punctuation : Trailing punctuation in heading : https://github.com/DavidAnson/markdownlint/blob/v0.37.4/doc/md026.md
|
||||
MD026:
|
||||
|
|
@ -186,10 +186,12 @@ MD040:
|
|||
|
||||
# MD041/first-line-heading/first-line-h1 : First line in a file should be a top-level heading : https://github.com/DavidAnson/markdownlint/blob/v0.37.4/doc/md041.md
|
||||
MD041:
|
||||
# Heading level
|
||||
level: 1
|
||||
# Allow content before first heading
|
||||
allow_preamble: false
|
||||
# RegExp for matching title in front matter
|
||||
front_matter_title: "^\\s*title\\s*[:=]"
|
||||
# Heading level
|
||||
level: 1
|
||||
|
||||
# MD042/no-empty-links : No empty links : https://github.com/DavidAnson/markdownlint/blob/v0.37.4/doc/md042.md
|
||||
MD042: true
|
||||
|
|
|
|||
|
|
@ -367,20 +367,32 @@ for (const rule of rules) {
|
|||
break;
|
||||
case "MD025":
|
||||
case "MD041":
|
||||
scheme.properties = {
|
||||
"level": {
|
||||
"description": "Heading level",
|
||||
"type": "integer",
|
||||
"minimum": 1,
|
||||
"maximum": 6,
|
||||
"default": 1
|
||||
},
|
||||
"front_matter_title": {
|
||||
"description": "RegExp for matching title in front matter",
|
||||
"type": "string",
|
||||
"default": "^\\s*title\\s*[:=]"
|
||||
}
|
||||
};
|
||||
{
|
||||
const md041Properties = (ruleName === "MD041") ?
|
||||
{
|
||||
"allow_preamble": {
|
||||
"description": "Allow content before first heading",
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
}
|
||||
} :
|
||||
{};
|
||||
scheme.properties = {
|
||||
...md041Properties,
|
||||
"front_matter_title": {
|
||||
"description": "RegExp for matching title in front matter",
|
||||
"type": "string",
|
||||
"default": "^\\s*title\\s*[:=]"
|
||||
},
|
||||
"level": {
|
||||
"description": "Heading level",
|
||||
"type": "integer",
|
||||
"minimum": 1,
|
||||
"maximum": 6,
|
||||
"default": 1
|
||||
}
|
||||
};
|
||||
}
|
||||
break;
|
||||
case "MD043":
|
||||
scheme.properties = {
|
||||
|
|
|
|||
|
|
@ -628,17 +628,17 @@
|
|||
],
|
||||
"default": true,
|
||||
"properties": {
|
||||
"front_matter_title": {
|
||||
"description": "RegExp for matching title in front matter",
|
||||
"type": "string",
|
||||
"default": "^\\s*title\\s*[:=]"
|
||||
},
|
||||
"level": {
|
||||
"description": "Heading level",
|
||||
"type": "integer",
|
||||
"minimum": 1,
|
||||
"maximum": 6,
|
||||
"default": 1
|
||||
},
|
||||
"front_matter_title": {
|
||||
"description": "RegExp for matching title in front matter",
|
||||
"type": "string",
|
||||
"default": "^\\s*title\\s*[:=]"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
|
|
@ -651,17 +651,17 @@
|
|||
],
|
||||
"default": true,
|
||||
"properties": {
|
||||
"front_matter_title": {
|
||||
"description": "RegExp for matching title in front matter",
|
||||
"type": "string",
|
||||
"default": "^\\s*title\\s*[:=]"
|
||||
},
|
||||
"level": {
|
||||
"description": "Heading level",
|
||||
"type": "integer",
|
||||
"minimum": 1,
|
||||
"maximum": 6,
|
||||
"default": 1
|
||||
},
|
||||
"front_matter_title": {
|
||||
"description": "RegExp for matching title in front matter",
|
||||
"type": "string",
|
||||
"default": "^\\s*title\\s*[:=]"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
|
|
@ -674,17 +674,17 @@
|
|||
],
|
||||
"default": true,
|
||||
"properties": {
|
||||
"front_matter_title": {
|
||||
"description": "RegExp for matching title in front matter",
|
||||
"type": "string",
|
||||
"default": "^\\s*title\\s*[:=]"
|
||||
},
|
||||
"level": {
|
||||
"description": "Heading level",
|
||||
"type": "integer",
|
||||
"minimum": 1,
|
||||
"maximum": 6,
|
||||
"default": 1
|
||||
},
|
||||
"front_matter_title": {
|
||||
"description": "RegExp for matching title in front matter",
|
||||
"type": "string",
|
||||
"default": "^\\s*title\\s*[:=]"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
|
|
@ -1117,17 +1117,22 @@
|
|||
],
|
||||
"default": true,
|
||||
"properties": {
|
||||
"allow_preamble": {
|
||||
"description": "Allow content before first heading",
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"front_matter_title": {
|
||||
"description": "RegExp for matching title in front matter",
|
||||
"type": "string",
|
||||
"default": "^\\s*title\\s*[:=]"
|
||||
},
|
||||
"level": {
|
||||
"description": "Heading level",
|
||||
"type": "integer",
|
||||
"minimum": 1,
|
||||
"maximum": 6,
|
||||
"default": 1
|
||||
},
|
||||
"front_matter_title": {
|
||||
"description": "RegExp for matching title in front matter",
|
||||
"type": "string",
|
||||
"default": "^\\s*title\\s*[:=]"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
|
|
@ -1140,17 +1145,22 @@
|
|||
],
|
||||
"default": true,
|
||||
"properties": {
|
||||
"allow_preamble": {
|
||||
"description": "Allow content before first heading",
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"front_matter_title": {
|
||||
"description": "RegExp for matching title in front matter",
|
||||
"type": "string",
|
||||
"default": "^\\s*title\\s*[:=]"
|
||||
},
|
||||
"level": {
|
||||
"description": "Heading level",
|
||||
"type": "integer",
|
||||
"minimum": 1,
|
||||
"maximum": 6,
|
||||
"default": 1
|
||||
},
|
||||
"front_matter_title": {
|
||||
"description": "RegExp for matching title in front matter",
|
||||
"type": "string",
|
||||
"default": "^\\s*title\\s*[:=]"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
|
|
@ -1163,17 +1173,22 @@
|
|||
],
|
||||
"default": true,
|
||||
"properties": {
|
||||
"allow_preamble": {
|
||||
"description": "Allow content before first heading",
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"front_matter_title": {
|
||||
"description": "RegExp for matching title in front matter",
|
||||
"type": "string",
|
||||
"default": "^\\s*title\\s*[:=]"
|
||||
},
|
||||
"level": {
|
||||
"description": "Heading level",
|
||||
"type": "integer",
|
||||
"minimum": 1,
|
||||
"maximum": 6,
|
||||
"default": 1
|
||||
},
|
||||
"front_matter_title": {
|
||||
"description": "RegExp for matching title in front matter",
|
||||
"type": "string",
|
||||
"default": "^\\s*title\\s*[:=]"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
|
|
|
|||
|
|
@ -628,17 +628,17 @@
|
|||
],
|
||||
"default": true,
|
||||
"properties": {
|
||||
"front_matter_title": {
|
||||
"description": "RegExp for matching title in front matter",
|
||||
"type": "string",
|
||||
"default": "^\\s*title\\s*[:=]"
|
||||
},
|
||||
"level": {
|
||||
"description": "Heading level",
|
||||
"type": "integer",
|
||||
"minimum": 1,
|
||||
"maximum": 6,
|
||||
"default": 1
|
||||
},
|
||||
"front_matter_title": {
|
||||
"description": "RegExp for matching title in front matter",
|
||||
"type": "string",
|
||||
"default": "^\\s*title\\s*[:=]"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
|
|
@ -651,17 +651,17 @@
|
|||
],
|
||||
"default": true,
|
||||
"properties": {
|
||||
"front_matter_title": {
|
||||
"description": "RegExp for matching title in front matter",
|
||||
"type": "string",
|
||||
"default": "^\\s*title\\s*[:=]"
|
||||
},
|
||||
"level": {
|
||||
"description": "Heading level",
|
||||
"type": "integer",
|
||||
"minimum": 1,
|
||||
"maximum": 6,
|
||||
"default": 1
|
||||
},
|
||||
"front_matter_title": {
|
||||
"description": "RegExp for matching title in front matter",
|
||||
"type": "string",
|
||||
"default": "^\\s*title\\s*[:=]"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
|
|
@ -674,17 +674,17 @@
|
|||
],
|
||||
"default": true,
|
||||
"properties": {
|
||||
"front_matter_title": {
|
||||
"description": "RegExp for matching title in front matter",
|
||||
"type": "string",
|
||||
"default": "^\\s*title\\s*[:=]"
|
||||
},
|
||||
"level": {
|
||||
"description": "Heading level",
|
||||
"type": "integer",
|
||||
"minimum": 1,
|
||||
"maximum": 6,
|
||||
"default": 1
|
||||
},
|
||||
"front_matter_title": {
|
||||
"description": "RegExp for matching title in front matter",
|
||||
"type": "string",
|
||||
"default": "^\\s*title\\s*[:=]"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
|
|
@ -1117,17 +1117,22 @@
|
|||
],
|
||||
"default": true,
|
||||
"properties": {
|
||||
"allow_preamble": {
|
||||
"description": "Allow content before first heading",
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"front_matter_title": {
|
||||
"description": "RegExp for matching title in front matter",
|
||||
"type": "string",
|
||||
"default": "^\\s*title\\s*[:=]"
|
||||
},
|
||||
"level": {
|
||||
"description": "Heading level",
|
||||
"type": "integer",
|
||||
"minimum": 1,
|
||||
"maximum": 6,
|
||||
"default": 1
|
||||
},
|
||||
"front_matter_title": {
|
||||
"description": "RegExp for matching title in front matter",
|
||||
"type": "string",
|
||||
"default": "^\\s*title\\s*[:=]"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
|
|
@ -1140,17 +1145,22 @@
|
|||
],
|
||||
"default": true,
|
||||
"properties": {
|
||||
"allow_preamble": {
|
||||
"description": "Allow content before first heading",
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"front_matter_title": {
|
||||
"description": "RegExp for matching title in front matter",
|
||||
"type": "string",
|
||||
"default": "^\\s*title\\s*[:=]"
|
||||
},
|
||||
"level": {
|
||||
"description": "Heading level",
|
||||
"type": "integer",
|
||||
"minimum": 1,
|
||||
"maximum": 6,
|
||||
"default": 1
|
||||
},
|
||||
"front_matter_title": {
|
||||
"description": "RegExp for matching title in front matter",
|
||||
"type": "string",
|
||||
"default": "^\\s*title\\s*[:=]"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
|
|
@ -1163,17 +1173,22 @@
|
|||
],
|
||||
"default": true,
|
||||
"properties": {
|
||||
"allow_preamble": {
|
||||
"description": "Allow content before first heading",
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"front_matter_title": {
|
||||
"description": "RegExp for matching title in front matter",
|
||||
"type": "string",
|
||||
"default": "^\\s*title\\s*[:=]"
|
||||
},
|
||||
"level": {
|
||||
"description": "Heading level",
|
||||
"type": "integer",
|
||||
"minimum": 1,
|
||||
"maximum": 6,
|
||||
"default": 1
|
||||
},
|
||||
"front_matter_title": {
|
||||
"description": "RegExp for matching title in front matter",
|
||||
"type": "string",
|
||||
"default": "^\\s*title\\s*[:=]"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue