2018-01-21 21:44:25 -08:00
|
|
|
// @ts-check
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
2019-04-13 11:18:57 -07:00
|
|
|
const { addErrorDetailIf, filterTokens } = require("../helpers");
|
2018-01-21 21:44:25 -08:00
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
"names": [ "MD035", "hr-style" ],
|
|
|
|
"description": "Horizontal rule style",
|
|
|
|
"tags": [ "hr" ],
|
|
|
|
"function": function MD035(params, onError) {
|
2020-01-25 18:40:39 -08:00
|
|
|
let style = String(params.config.style || "consistent");
|
2019-04-13 11:18:57 -07:00
|
|
|
filterTokens(params, "hr", function forToken(token) {
|
2018-04-27 22:05:34 -07:00
|
|
|
const lineTrim = token.line.trim();
|
2018-01-21 21:44:25 -08:00
|
|
|
if (style === "consistent") {
|
|
|
|
style = lineTrim;
|
|
|
|
}
|
2019-04-13 11:18:57 -07:00
|
|
|
addErrorDetailIf(onError, token.lineNumber, style, lineTrim);
|
2018-01-21 21:44:25 -08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|