3
0
mirror of https://github.com/larvit/adf-codec.git synced 2026-11-18 14:15:44 +01:00

Use adfToPlainText's step helper in its writer

This commit is contained in:
2026-11-14 16:17:28 +01:00
committed by Lillem4n
parent d374115a8a
commit cbaf56a0df
+2 -4
View File
@@ -76,10 +76,8 @@ function writeText(content: readonly AdfNode[]): Result<string> {
if (node.type === 'hardBreak') gap += 1
else if (shownTextTypes.includes(node.type)) emit(shownText(node) ?? '')
else {
if (typeof node.text === 'string') emit(node.text)
if (suffix !== undefined) emit(suffix)
const layout = layoutOf(node)
for (const child of childSteps(nodeContent(node), layout, depth + layout.level, place, markerFor(node)).reverse()) pending.push(child)
emit(`${node.text ?? ''}${suffix ?? ''}`)
for (const child of stepsWithin(node, depth, place).reverse()) pending.push(child)
}
if (length > longestOutput) return tooLong()
}