Update MD035/hr-style to correctly match thematic breaks in block quotes.

This commit is contained in:
David Anson 2021-12-14 23:05:03 -08:00
parent 517eb42015
commit 8fde53cf31
9 changed files with 130 additions and 16 deletions

View file

@ -3376,12 +3376,12 @@ module.exports = {
"tags": ["hr"],
"function": function MD035(params, onError) {
var style = String(params.config.style || "consistent");
filterTokens(params, "hr", function forToken(token) {
var lineTrim = token.line.trim();
filterTokens(params, "hr", function (token) {
var lineNumber = token.lineNumber, markup = token.markup;
if (style === "consistent") {
style = lineTrim;
style = markup;
}
addErrorDetailIf(onError, token.lineNumber, style, lineTrim);
addErrorDetailIf(onError, lineNumber, style, markup);
});
}
};

View file

@ -1368,8 +1368,8 @@ Tags: hr
Aliases: hr-style
Parameters: style ("consistent", "---", "***", or other string specifying the
horizontal rule; default "consistent")
Parameters: style ("consistent", "---", "***", "___", or other string specifying
the horizontal rule; default "consistent")
This rule is triggered when inconsistent styles of horizontal rules are used
in the document:

View file

@ -10,12 +10,12 @@ module.exports = {
"tags": [ "hr" ],
"function": function MD035(params, onError) {
let style = String(params.config.style || "consistent");
filterTokens(params, "hr", function forToken(token) {
const lineTrim = token.line.trim();
filterTokens(params, "hr", (token) => {
const { lineNumber, markup } = token;
if (style === "consistent") {
style = lineTrim;
style = markup;
}
addErrorDetailIf(onError, token.lineNumber, style, lineTrim);
addErrorDetailIf(onError, lineNumber, style, markup);
});
}
};

View file

@ -0,0 +1,39 @@
# HR in Blockquote, Dash
---
***
___
{MD035:5} {MD035:7}
> Text
>
> ---
>
> ***
>
> ___
>
> Text
{MD035:15} {MD035:17}
- - -
> Text
>
> > Text
> >
> > ---
> >
> > ***
> >
> > ___
> >
> > Text
>
> Text
{MD035:31} {MD035:33}

View file

@ -0,0 +1,39 @@
# HR in Blockquote, Star
***
___
---
{MD035:5} {MD035:7}
> Text
>
> ---
>
> ***
>
> ___
>
> Text
{MD035:13} {MD035:17}
* * *
> Text
>
> > Text
> >
> > ---
> >
> > ***
> >
> > ___
> >
> > Text
>
> Text
{MD035:29} {MD035:33}

View file

@ -0,0 +1,39 @@
# HR in Blockquote, Under
___
---
***
{MD035:5} {MD035:7}
> Text
>
> ---
>
> ***
>
> ___
>
> Text
{MD035:13} {MD035:15}
_ _ _
> Text
>
> > Text
> >
> > ---
> >
> > ***
> >
> > ___
> >
> > Text
>
> Text
{MD035:29} {MD035:31}

View file

@ -20,5 +20,4 @@ _____
***
{MD035:3} {MD035:5} {MD035:7} {MD035:11} {MD035:13} {MD035:15} {MD035:17}
{MD035:19} {MD035:21}
{MD035:3} {MD035:5} {MD035:7} {MD035:13} {MD035:15} {MD035:17} {MD035:19} {MD035:21}

View file

@ -20,5 +20,4 @@ _____
***
{MD035:5} {MD035:7} {MD035:9} {MD035:11} {MD035:13} {MD035:15} {MD035:17}
{MD035:19}
{MD035:7} {MD035:9} {MD035:11} {MD035:13} {MD035:15} {MD035:17} {MD035:19}

View file

@ -20,5 +20,4 @@ _____
***
{MD035:5} {MD035:7} {MD035:9} {MD035:11} {MD035:13} {MD035:15} {MD035:17}
{MD035:19}
{MD035:7} {MD035:9} {MD035:11} {MD035:13} {MD035:15} {MD035:17} {MD035:19}