Add simple/concrete example of custom rule package for publishing (fixes #133).

This commit is contained in:
David Anson 2018-07-20 22:31:41 -07:00
parent 183d9c5cb1
commit 23d5be6015
4 changed files with 49 additions and 9 deletions

View file

@ -1,13 +1,13 @@
{
"name": "markdownlint-rules-test",
"name": "markdownlint-rule-sample",
"version": "0.0.1",
"description": "Package of markdownlint custom rules used for testing",
"main": "rules.js",
"description": "Package for markdownlint custom rule sample",
"main": "sample-rule.js",
"author": "David Anson (https://dlaa.me/)",
"homepage": "https://github.com/DavidAnson/markdownlint",
"license": "MIT",
"keywords": [
"markdownlint-rules"
"markdownlint-rule"
],
"private": true
}

View file

@ -0,0 +1,19 @@
// @ts-check
"use strict";
module.exports = {
"names": [ "sample-rule" ],
"description": "Sample rule",
"tags": [ "sample" ],
"function": function rule(params, onError) {
params.tokens.forEach((token) => {
if (token.type === "hr") {
onError({
"lineNumber": token.lineNumber,
"detail": "Sample error for hr"
});
}
});
}
};