Update MD001/heading-increment to support front matter title as the first heading of the page.

This commit is contained in:
Alexandre Feblot 2025-06-07 04:54:23 +02:00 committed by GitHub
parent a366f80873
commit 1b6839bff0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 317 additions and 16 deletions

View file

@ -8,7 +8,10 @@
"extends": null,
// MD001/heading-increment : Heading levels should only increment by one level at a time : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md001.md
"MD001": true,
"MD001": {
// RegExp for matching title in front matter
"front_matter_title": "^\\s*title\\s*[:=]"
},
// MD003/heading-style : Heading style : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md003.md
"MD003": {

View file

@ -7,7 +7,9 @@ default: true
extends: null
# MD001/heading-increment : Heading levels should only increment by one level at a time : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md001.md
MD001: true
MD001:
# RegExp for matching title in front matter
front_matter_title: "^\\s*title\\s*[:=]"
# MD003/heading-style : Heading style : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md003.md
MD003:

View file

@ -64,6 +64,15 @@ for (const rule of rules) {
};
let custom = true;
switch (ruleName) {
case "MD001":
scheme.properties = {
"front_matter_title": {
"description": "RegExp for matching title in front matter",
"type": "string",
"default": "^\\s*title\\s*[:=]"
}
};
break;
case "MD003":
scheme.properties = {
"style": {

View file

@ -24,13 +24,35 @@
},
"MD001": {
"description": "MD001/heading-increment : Heading levels should only increment by one level at a time : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md001.md",
"type": "boolean",
"default": true
"type": [
"boolean",
"object"
],
"default": true,
"properties": {
"front_matter_title": {
"description": "RegExp for matching title in front matter",
"type": "string",
"default": "^\\s*title\\s*[:=]"
}
},
"additionalProperties": false
},
"heading-increment": {
"description": "MD001/heading-increment : Heading levels should only increment by one level at a time : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md001.md",
"type": "boolean",
"default": true
"type": [
"boolean",
"object"
],
"default": true,
"properties": {
"front_matter_title": {
"description": "RegExp for matching title in front matter",
"type": "string",
"default": "^\\s*title\\s*[:=]"
}
},
"additionalProperties": false
},
"MD003": {
"description": "MD003/heading-style : Heading style : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md003.md",

View file

@ -24,13 +24,35 @@
},
"MD001": {
"description": "MD001/heading-increment : Heading levels should only increment by one level at a time : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md001.md",
"type": "boolean",
"default": true
"type": [
"boolean",
"object"
],
"default": true,
"properties": {
"front_matter_title": {
"description": "RegExp for matching title in front matter",
"type": "string",
"default": "^\\s*title\\s*[:=]"
}
},
"additionalProperties": false
},
"heading-increment": {
"description": "MD001/heading-increment : Heading levels should only increment by one level at a time : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md001.md",
"type": "boolean",
"default": true
"type": [
"boolean",
"object"
],
"default": true,
"properties": {
"front_matter_title": {
"description": "RegExp for matching title in front matter",
"type": "string",
"default": "^\\s*title\\s*[:=]"
}
},
"additionalProperties": false
},
"MD003": {
"description": "MD003/heading-style : Heading style : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md003.md",