mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02:00
Update MD035/hr-style to correctly match thematic breaks in block quotes.
This commit is contained in:
parent
517eb42015
commit
8fde53cf31
9 changed files with 130 additions and 16 deletions
|
@ -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);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
39
test/hr-in-blockquote-dash.md
Normal file
39
test/hr-in-blockquote-dash.md
Normal 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}
|
39
test/hr-in-blockquote-star.md
Normal file
39
test/hr-in-blockquote-star.md
Normal 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}
|
39
test/hr-in-blockquote-under.md
Normal file
39
test/hr-in-blockquote-under.md
Normal 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}
|
|
@ -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}
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -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}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue