From cbaf56a0df473eb6406a5ef76574e13b6012f8ea Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Sat, 14 Nov 2026 16:17:28 +0100 Subject: [PATCH] Use adfToPlainText's step helper in its writer --- src/plain-text/adf-to-plain-text.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/plain-text/adf-to-plain-text.ts b/src/plain-text/adf-to-plain-text.ts index 659421d..9bab89e 100644 --- a/src/plain-text/adf-to-plain-text.ts +++ b/src/plain-text/adf-to-plain-text.ts @@ -76,10 +76,8 @@ function writeText(content: readonly AdfNode[]): Result { 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() }