Update MD027/no-multiple-space-blockquote to handle multiple lines of indented code inside a blockquote (fixes #1393).

This commit is contained in:
David Anson 2024-10-28 21:40:39 -07:00
parent 368cb1be5f
commit 0eedda0a6c
5 changed files with 44 additions and 4 deletions

View file

@ -4680,9 +4680,15 @@ module.exports = {
"tags": [ "blockquote", "whitespace", "indentation" ],
"parser": "micromark",
"function": function MD027(params, onError) {
const { tokens } = params.parsers.micromark;
for (const token of filterByTypesCached([ "linePrefix" ])) {
const siblings = token.parent?.children || params.parsers.micromark.tokens;
if (siblings[siblings.indexOf(token) - 1]?.type === "blockQuotePrefix") {
const parent = token.parent;
const codeIndented = parent?.type === "codeIndented";
const siblings = parent?.children || tokens;
if (
!codeIndented &&
(siblings[siblings.indexOf(token) - 1]?.type === "blockQuotePrefix")
) {
const { startColumn, startLine, text } = token;
const { length } = text;
const line = params.lines[startLine - 1];