mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-18 06:50:12 +01:00
Expose shared.js helper code for custom rule authors (fixes #134).
This commit is contained in:
parent
f614f3e1ce
commit
7e980401b8
52 changed files with 283 additions and 184 deletions
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const shared = require("./shared");
|
||||
const { addErrorDetailIf, filterTokens } = require("../helpers");
|
||||
|
||||
module.exports = {
|
||||
"names": [ "MD035", "hr-style" ],
|
||||
|
|
@ -10,12 +10,12 @@ module.exports = {
|
|||
"tags": [ "hr" ],
|
||||
"function": function MD035(params, onError) {
|
||||
let style = params.config.style || "consistent";
|
||||
shared.filterTokens(params, "hr", function forToken(token) {
|
||||
filterTokens(params, "hr", function forToken(token) {
|
||||
const lineTrim = token.line.trim();
|
||||
if (style === "consistent") {
|
||||
style = lineTrim;
|
||||
}
|
||||
shared.addErrorDetailIf(onError, token.lineNumber, style, lineTrim);
|
||||
addErrorDetailIf(onError, token.lineNumber, style, lineTrim);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue