mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 14:00:13 +01:00
Add support for authoring custom rules.
This commit is contained in:
parent
f24f98e146
commit
802c81f929
6 changed files with 375 additions and 97 deletions
|
|
@ -3,8 +3,8 @@
|
|||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
"names": [ "blockquote" ],
|
||||
"description": "Rule that reports an error for blockquotes",
|
||||
"names": [ "any-blockquote" ],
|
||||
"description": "Rule that reports an error for any blockquote",
|
||||
"tags": [ "test" ],
|
||||
"function": function rule(params, onError) {
|
||||
params.tokens.filter(function filterToken(token) {
|
||||
18
test/rules/first-line.js
Normal file
18
test/rules/first-line.js
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
// @ts-check
|
||||
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
"names": [ "first-line" ],
|
||||
"description": "Rule that reports an error for the first line",
|
||||
"tags": [ "test" ],
|
||||
"function": function rule(params, onError) {
|
||||
// Unconditionally report an error for line 1
|
||||
onError({
|
||||
"lineNumber": 1,
|
||||
"detail": null,
|
||||
"context": null,
|
||||
"range": null
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -2,17 +2,21 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
var blockquote = require("./blockquote");
|
||||
module.exports.blockquote = blockquote;
|
||||
var anyBlockquote = require("./any-blockquote");
|
||||
module.exports.anyBlockquote = anyBlockquote;
|
||||
|
||||
var everyNLines = require("./every-n-lines");
|
||||
module.exports.everyNLines = everyNLines;
|
||||
|
||||
var firstLine = require("./first-line");
|
||||
module.exports.firstLine = firstLine;
|
||||
|
||||
var lettersEX = require("./letters-E-X");
|
||||
module.exports.lettersEX = lettersEX;
|
||||
|
||||
module.exports.all = [
|
||||
blockquote,
|
||||
anyBlockquote,
|
||||
everyNLines,
|
||||
firstLine,
|
||||
lettersEX
|
||||
];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue