Update MD024/no-duplicate-heading to allow non-sibling duplicates (fixes #136).

This commit is contained in:
David Anson 2018-07-19 21:49:30 -07:00
parent 4865301ce9
commit d76ede1c4f
10 changed files with 246 additions and 15 deletions

View file

@ -25,6 +25,7 @@ const schema = {
const tags = {};
// Add rules
// eslint-disable-next-line complexity
rules.forEach(function forRule(rule) {
rule.tags.forEach(function forTag(tag) {
const tagRules = tags[tag] || [];
@ -151,6 +152,20 @@ rules.forEach(function forRule(rule) {
}
};
break;
case "MD024":
scheme.properties = {
"allow_different_nesting": {
"description": "Only check sibling headings",
"type": "boolean",
"default": false
},
"siblings_only": {
"description": "Only check sibling headings",
"type": "boolean",
"default": false
}
};
break;
case "MD026":
case "MD036":
scheme.properties = {

View file

@ -515,18 +515,66 @@
},
"MD024": {
"description": "MD024/no-duplicate-heading/no-duplicate-header - Multiple headings with the same content",
"type": "boolean",
"default": true
"type": [
"boolean",
"object"
],
"default": true,
"properties": {
"allow_different_nesting": {
"description": "Only check sibling headings",
"type": "boolean",
"default": false
},
"siblings_only": {
"description": "Only check sibling headings",
"type": "boolean",
"default": false
}
},
"additionalProperties": false
},
"no-duplicate-heading": {
"description": "MD024/no-duplicate-heading/no-duplicate-header - Multiple headings with the same content",
"type": "boolean",
"default": true
"type": [
"boolean",
"object"
],
"default": true,
"properties": {
"allow_different_nesting": {
"description": "Only check sibling headings",
"type": "boolean",
"default": false
},
"siblings_only": {
"description": "Only check sibling headings",
"type": "boolean",
"default": false
}
},
"additionalProperties": false
},
"no-duplicate-header": {
"description": "MD024/no-duplicate-heading/no-duplicate-header - Multiple headings with the same content",
"type": "boolean",
"default": true
"type": [
"boolean",
"object"
],
"default": true,
"properties": {
"allow_different_nesting": {
"description": "Only check sibling headings",
"type": "boolean",
"default": false
},
"siblings_only": {
"description": "Only check sibling headings",
"type": "boolean",
"default": false
}
},
"additionalProperties": false
},
"MD025": {
"description": "MD025/single-h1 - Multiple top level headings in the same document",