markdownlint/lib/md024.js
Milos Levacic 45424cf459 Change "header" to "heading" across the library
This should be backward compatible, as all "header" aliases are still
available, though documented as discouraged for future use.
2018-04-18 22:27:48 -07:00

22 lines
616 B
JavaScript

// @ts-check
"use strict";
var shared = require("./shared");
module.exports = {
"names": [ "MD024", "no-duplicate-heading", "no-duplicate-header" ],
"description": "Multiple headings with the same content",
"tags": [ "headings", "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());
}
});
}
};