mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-18 15:00:13 +01:00
Everything under `lib/rules/*` is a rules file (with the name of the rule in camelCase), re-exported into an array in `lib/rules.js`. Moved the regular expressions from `lib/rules.js` to `lib/expressions.js`, and the rest of the variables into `lib/shared.js`.
18 lines
505 B
JavaScript
18 lines
505 B
JavaScript
module.exports = {
|
|
"name": "MD002",
|
|
"desc": "First header should be a top level header",
|
|
"tags": [ "headers" ],
|
|
"aliases": [ "first-header-h1" ],
|
|
"regexp": null,
|
|
"func": function MD002(params, errors) {
|
|
var level = params.options.level || 1;
|
|
var tag = "h" + level;
|
|
params.tokens.every(function forToken(token) {
|
|
if (token.type === "heading_open") {
|
|
errors.addDetailIf(token.lineNumber, tag, token.tag);
|
|
return false;
|
|
}
|
|
return true;
|
|
});
|
|
}
|
|
};
|