mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02:00
24 lines
699 B
JavaScript
24 lines
699 B
JavaScript
// @ts-check
|
|
|
|
"use strict";
|
|
|
|
const { addErrorDetailIf } = require("../helpers");
|
|
const { filterByTypes } = require("../helpers/micromark.cjs");
|
|
|
|
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();
|
|
const thematicBreaks =
|
|
filterByTypes(params.parsers.micromark.tokens, [ "thematicBreak" ]);
|
|
for (const token of thematicBreaks) {
|
|
const { startLine, text } = token;
|
|
if (style === "consistent") {
|
|
style = text;
|
|
}
|
|
addErrorDetailIf(onError, startLine, style, text);
|
|
}
|
|
}
|
|
};
|