mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 14:30:12 +01:00
23 lines
579 B
JavaScript
23 lines
579 B
JavaScript
|
|
// @ts-check
|
||
|
|
|
||
|
|
"use strict";
|
||
|
|
|
||
|
|
var shared = require("./shared");
|
||
|
|
|
||
|
|
module.exports = {
|
||
|
|
"names": [ "MD024", "no-duplicate-header" ],
|
||
|
|
"description": "Multiple headers with the same content",
|
||
|
|
"tags": [ "headers" ],
|
||
|
|
"function": function MD024(params, onError) {
|
||
|
|
var knownContent = [];
|
||
|
|
shared.forEachHeading(params, function forHeading(heading, content) {
|
||
|
|
if (knownContent.indexOf(content) === -1) {
|
||
|
|
knownContent.push(content);
|
||
|
|
} else {
|
||
|
|
shared.addErrorContext(onError, heading.lineNumber,
|
||
|
|
heading.line.trim());
|
||
|
|
}
|
||
|
|
});
|
||
|
|
}
|
||
|
|
};
|