mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 06:20:12 +01:00
Add optional "information" property to custom rules to provide a link to more information.
This commit is contained in:
parent
b77dd5ccd3
commit
ff86e1d7f1
14 changed files with 201 additions and 6 deletions
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const { URL } = require("url");
|
||||
const md = require("markdown-it")({ "html": true });
|
||||
const rules = require("./rules");
|
||||
const shared = require("./shared");
|
||||
|
|
@ -41,6 +42,11 @@ function validateRuleList(ruleList) {
|
|||
result = newError(property);
|
||||
}
|
||||
});
|
||||
if (!result && rule.information) {
|
||||
if (Object.getPrototypeOf(rule.information) !== URL.prototype) {
|
||||
result = newError("information");
|
||||
}
|
||||
}
|
||||
if (!result) {
|
||||
rule.names.forEach(function forName(name) {
|
||||
const nameUpper = name.toUpperCase();
|
||||
|
|
@ -373,6 +379,8 @@ function lintContent(
|
|||
errorObject.ruleNames = rule.names;
|
||||
}
|
||||
errorObject.ruleDescription = rule.description;
|
||||
errorObject.ruleInformation =
|
||||
rule.information ? rule.information.href : null;
|
||||
errorObject.errorDetail = error.detail;
|
||||
errorObject.errorContext = error.context;
|
||||
errorObject.errorRange = error.range;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue