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

@ -3613,9 +3613,14 @@ module.exports = {
"description": "Horizontal rule style",
"tags": ["hr"],
"function": function MD035(params, onError) {
var style = String(params.config.style || "consistent");
var style = String(params.config.style || "consistent").trim();
filterTokens(params, "hr", function (token) {
var lineNumber = token.lineNumber, markup = token.markup;
var line = token.line, lineNumber = token.lineNumber;
var markup = token.markup;
var match = line.match(/[_*\-\s\t]+$/);
if (match) {
markup = match[0].trim();
}
if (style === "consistent") {
style = markup;
}