mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-21 21:30:47 +02:00
26 lines
697 B
JavaScript
26 lines
697 B
JavaScript
// @ts-check
|
|
|
|
"use strict";
|
|
|
|
const { addErrorDetailIf, filterTokens } = require("../helpers");
|
|
|
|
module.exports = {
|
|
"names": [ "MD035", "hr-style" ],
|
|
"description": "Horizontal rule style",
|
|
"tags": [ "hr" ],
|
|
"function": function MD035(params, onError) {
|
|
let style = String(params.config.style || "consistent").trim();
|
|
filterTokens(params, "hr", (token) => {
|
|
const { line, lineNumber } = token;
|
|
let { markup } = token;
|
|
const match = line.match(/[_*\-\s\t]+$/);
|
|
if (match) {
|
|
markup = match[0].trim();
|
|
}
|
|
if (style === "consistent") {
|
|
style = markup;
|
|
}
|
|
addErrorDetailIf(onError, lineNumber, style, markup);
|
|
});
|
|
}
|
|
};
|