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;
|
let prevBlankish = false;
|
||||||
while (i < lines.length) {
|
while (i < lines.length) {
|
||||||
const next = lines[i]!;
|
const next = lines[i]!;
|
||||||
const lazyIndent = !prevBlankish && next.trim() !== "" && /^ {4}/.test(next);
|
const indented = next.trim() !== "" && /^ {4}/.test(next);
|
||||||
if (!lazyIndent && isBlockStart(lines, i)) break;
|
if (indented ? prevBlankish : isBlockStart(lines, i)) break;
|
||||||
prevBlankish = next.trim() === "";
|
prevBlankish = next.trim() === "";
|
||||||
raw += next;
|
raw += next;
|
||||||
i++;
|
i++;
|
||||||
|
|||||||
@@ -112,6 +112,13 @@ describe("marked compatibility", () => {
|
|||||||
["hr", "---\n"],
|
["hr", "---\n"],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
"lead\n \n deeper code\n",
|
||||||
|
[
|
||||||
|
["paragraph", "lead\n \n"],
|
||||||
|
["code", " deeper code\n"],
|
||||||
|
],
|
||||||
|
],
|
||||||
];
|
];
|
||||||
for (const [source, shape] of lazyBoundaryShapes) {
|
for (const [source, shape] of lazyBoundaryShapes) {
|
||||||
test(`keeps the lazy-continuation boundary shape for ${JSON.stringify(source)}`, () => {
|
test(`keeps the lazy-continuation boundary shape for ${JSON.stringify(source)}`, () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user