4c - the guard's spread was a class: the code block's held lines and a mark run's segments too

This commit is contained in:
2026-09-18 19:52:00 +02:00
parent 047ce3bc42
commit 0361646e1a
8 changed files with 31 additions and 15 deletions
@@ -736,3 +736,8 @@ test('carries whitespace CommonMark strips in the reserved text directive', () =
// CommonMark strips spaces and tabs alone, so the whitespace beside them is plain text.
assert.equal(emitted({ text: '\va\f', type: 'text' }), '\va\f\n')
})
test("joins a mark run's segments as a walk rather than as one call's arguments", () => {
const run = Array.from({ length: 200000 }, (): AdfNode => ({ marks: [{ type: 'strong' }], text: 'a', type: 'text' }))
assert.equal(markdown(adfToMarkdown(document({ content: run, type: 'paragraph' }))), `**${'a'.repeat(200000)}**\n`)
})
+1 -1
View File
@@ -166,7 +166,7 @@ function emitRun(nodes: readonly AdfNode[], depth: number, firstIndex: number, c
const emitted = run.kind === 'plain' ? emitLeaf(run.node, runContext, run.index) : emitMarkedRun(run.nodes, run.mark, depth, run.index, runContext)
if (!emitted.ok) return emitted
if (emitted.value.carry !== undefined) return emitted
segments.push(...emitted.value.segments)
for (const segment of emitted.value.segments) segments.push(segment)
}
return success({ segments })
}