diff --git a/packages/utils/src/marked/core.ts b/packages/utils/src/marked/core.ts index fb4e9fb24..6bf733fcc 100644 --- a/packages/utils/src/marked/core.ts +++ b/packages/utils/src/marked/core.ts @@ -1080,8 +1080,8 @@ function blockTokens(src: string, lexer: Lexer, output: Token[]): Token[] { let prevBlankish = false; while (i < lines.length) { const next = lines[i]!; - const lazyIndent = !prevBlankish && next.trim() !== "" && /^ {4}/.test(next); - if (!lazyIndent && isBlockStart(lines, i)) break; + const indented = next.trim() !== "" && /^ {4}/.test(next); + if (indented ? prevBlankish : isBlockStart(lines, i)) break; prevBlankish = next.trim() === ""; raw += next; i++; diff --git a/packages/utils/test/marked.test.ts b/packages/utils/test/marked.test.ts index d7907520f..71a1ab401 100644 --- a/packages/utils/test/marked.test.ts +++ b/packages/utils/test/marked.test.ts @@ -112,6 +112,13 @@ describe("marked compatibility", () => { ["hr", "---\n"], ], ], + [ + "lead\n \n deeper code\n", + [ + ["paragraph", "lead\n \n"], + ["code", " deeper code\n"], + ], + ], ]; for (const [source, shape] of lazyBoundaryShapes) { test(`keeps the lazy-continuation boundary shape for ${JSON.stringify(source)}`, () => {