markdownlint/lib/md002.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
598 B
JavaScript

// @ts-check
"use strict";
var shared = require("./shared");
module.exports = {
"names": [ "MD002", "first-heading-h1", "first-header-h1" ],
"description": "First heading should be a top level heading",
"tags": [ "headings", "headers" ],
"function": function MD002(params, onError) {
var level = params.config.level || 1;
var tag = "h" + level;
params.tokens.every(function forToken(token) {
if (token.type === "heading_open") {
shared.addErrorDetailIf(onError, token.lineNumber, tag, token.tag);
return false;
}
return true;
});
}
};