diff --git a/lib/rules.js b/lib/rules.js index 8b316de0..3cfee2e9 100644 --- a/lib/rules.js +++ b/lib/rules.js @@ -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); } }); diff --git a/test/blockquote_spaces.md b/test/blockquote_spaces.md index 084c27ad..a17bd054 100644 --- a/test/blockquote_spaces.md +++ b/test/blockquote_spaces.md @@ -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}