MD027 should support blockquote nesting

This commit is contained in:
OHTAKE Tomohiro 2016-09-09 10:30:22 +09:00 committed by David Anson
parent 84ff8bb616
commit cbfdff227e
2 changed files with 13 additions and 5 deletions

View file

@ -575,17 +575,17 @@ module.exports = [
"tags": [ "blockquote", "whitespace", "indentation" ],
"aliases": [ "no-multiple-space-blockquote" ],
"func": function MD027(params, errors) {
var inBlockquote = false;
var blockquoteNesting = 0;
params.tokens.forEach(function forToken(token) {
if (token.type === "blockquote_open") {
inBlockquote = true;
blockquoteNesting++;
} else if (token.type === "blockquote_close") {
inBlockquote = false;
} else if ((token.type === "inline") && inBlockquote) {
blockquoteNesting--;
} else if ((token.type === "inline") && blockquoteNesting > 0) {
token.content.split(shared.newLineRe)
.forEach(function forLine(line, offset) {
if (/^\s/.test(line) ||
(!offset && /^\s*>\s\s/.test(token.line))) {
(!offset && /^(\s*>)+\s\s/.test(token.line))) {
errors.push(token.lineNumber + offset);
}
});

View file

@ -21,3 +21,11 @@ Test the first line being indented too much:
> Foo {MD027}
> Bar {MD027}
> Baz
Nested blockquote
> A {MD027}
>
> > B {MD027}
>
> C {MD027}