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

22
lib/md011.js Normal file
View file

@ -0,0 +1,22 @@
// @ts-check
"use strict";
var shared = require("./shared");
var reversedLinkRe = /\([^)]+\)\[[^\]^][^\]]*]/;
module.exports = {
"names": [ "MD011", "no-reversed-links" ],
"description": "Reversed link syntax",
"tags": [ "links" ],
"function": function MD011(params, onError) {
shared.forEachInlineChild(params, "text", function forToken(token) {
var match = reversedLinkRe.exec(token.content);
if (match) {
shared.addError(onError, token.lineNumber, match[0], null,
shared.rangeFromRegExp(token.line, reversedLinkRe));
}
});
}
};