Update MD035/hr-style to preserve embedded spaces in thematic break markup (fixes #498).

This commit is contained in:
David Anson 2022-04-28 21:53:51 -07:00
parent b447c809bd
commit 7a5886b976
9 changed files with 49 additions and 10 deletions

View file

@ -9,9 +9,14 @@ module.exports = {
"description": "Horizontal rule style",
"tags": [ "hr" ],
"function": function MD035(params, onError) {
let style = String(params.config.style || "consistent");
let style = String(params.config.style || "consistent").trim();
filterTokens(params, "hr", (token) => {
const { lineNumber, markup } = 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;
}