fix(utils): detached deeper code after padded blanks
This commit is contained in:
@@ -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++;
|
||||
|
||||
@@ -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)}`, () => {
|
||||
|
||||
Reference in New Issue
Block a user