mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 22:10:13 +01:00
Update MD024/no-duplicate-heading to remove duplicate parameter allow_different_nesting which confuses people.
This commit is contained in:
parent
c39facc73f
commit
f2725178b1
15 changed files with 19 additions and 49 deletions
8
lib/configuration.d.ts
vendored
8
lib/configuration.d.ts
vendored
|
|
@ -384,10 +384,6 @@ export interface Configuration {
|
|||
MD024?:
|
||||
| boolean
|
||||
| {
|
||||
/**
|
||||
* Only check sibling headings
|
||||
*/
|
||||
allow_different_nesting?: boolean;
|
||||
/**
|
||||
* Only check sibling headings
|
||||
*/
|
||||
|
|
@ -399,10 +395,6 @@ export interface Configuration {
|
|||
"no-duplicate-heading"?:
|
||||
| boolean
|
||||
| {
|
||||
/**
|
||||
* Only check sibling headings
|
||||
*/
|
||||
allow_different_nesting?: boolean;
|
||||
/**
|
||||
* Only check sibling headings
|
||||
*/
|
||||
|
|
|
|||
12
lib/md024.js
12
lib/md024.js
|
|
@ -9,8 +9,7 @@ module.exports = {
|
|||
"description": "Multiple headings with the same content",
|
||||
"tags": [ "headings" ],
|
||||
"function": function MD024(params, onError) {
|
||||
const siblingsOnly = !!params.config.siblings_only ||
|
||||
!!params.config.allow_different_nesting || false;
|
||||
const siblingsOnly = !!params.config.siblings_only || false;
|
||||
const knownContents = [ null, [] ];
|
||||
let lastLevel = 1;
|
||||
let knownContent = knownContents[lastLevel];
|
||||
|
|
@ -27,10 +26,15 @@ module.exports = {
|
|||
}
|
||||
knownContent = knownContents[newLevel];
|
||||
}
|
||||
// @ts-ignore
|
||||
if (knownContent.includes(content)) {
|
||||
addErrorContext(onError, heading.lineNumber,
|
||||
heading.line.trim());
|
||||
addErrorContext(
|
||||
onError,
|
||||
heading.lineNumber,
|
||||
heading.line.trim()
|
||||
);
|
||||
} else {
|
||||
// @ts-ignore
|
||||
knownContent.push(content);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue