Move each rule implementation into its own file (fixes #83).

This commit is contained in:
David Anson 2018-01-21 21:44:25 -08:00
parent 49e36f817c
commit 9ba143555d
42 changed files with 1289 additions and 1028 deletions

21
lib/md019.js Normal file
View file

@ -0,0 +1,21 @@
// @ts-check
"use strict";
var shared = require("./shared");
module.exports = {
"names": [ "MD019", "no-multiple-space-atx" ],
"description": "Multiple spaces after hash on atx style header",
"tags": [ "headers", "atx", "spaces" ],
"function": function MD019(params, onError) {
shared.filterTokens(params, "heading_open", function forToken(token) {
if ((shared.headingStyleFor(token) === "atx") &&
/^#+\s\s/.test(token.line)) {
shared.addErrorContext(onError, token.lineNumber, token.line.trim(),
null, null,
shared.rangeFromRegExp(token.line, shared.atxHeaderSpaceRe));
}
});
}
};