From 1409a1699a627d7a3e7d4b0cc4407b85f01475ed Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Tue, 3 Nov 2026 21:54:29 +0100 Subject: [PATCH] =?UTF-8?q?Answer=20prose=20round=201:=200=20=F0=9F=94=B4,?= =?UTF-8?q?=202=20=F0=9F=9F=A1=20(0=20misread);=20say=20what=20insideRun's?= =?UTF-8?q?=20callers=20rely=20on,=20delete=20sharedRuns's=20comment,=20cl?= =?UTF-8?q?ear=20the=20termination=20comment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/markdown/mark-spellings.ts | 2 +- src/markdown/portable/inline-reduction.ts | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/markdown/mark-spellings.ts b/src/markdown/mark-spellings.ts index ca42526..0bebc98 100644 --- a/src/markdown/mark-spellings.ts +++ b/src/markdown/mark-spellings.ts @@ -44,7 +44,7 @@ export function isEmphasis(mark: AdfMark): boolean { return markSpelling(mark.type)?.kind === 'emphasis' } -// spec/flavour.md, Marks. The writers and the portable reducer group runs alike only while both ask this. +// spec/flavour.md, Marks. The portable reducer must ask this too, or it trims edge whitespace by runs the writers do not spell. export function insideRun({ node, outer }: RunNode, mark: AdfMark): RunNode | undefined { const held = nodeMarks(node)[outer] return held !== undefined && identicalMark(held, mark) ? { node, outer: outer + 1 } : undefined diff --git a/src/markdown/portable/inline-reduction.ts b/src/markdown/portable/inline-reduction.ts index d76db68..e279af5 100644 --- a/src/markdown/portable/inline-reduction.ts +++ b/src/markdown/portable/inline-reduction.ts @@ -162,7 +162,7 @@ function withMarks(leaf: AdfNode, marks: readonly AdfMark[]): AdfNode { } export function trimmedEdges(leaves: readonly AdfNode[]): AdfNode[] { - // Terminates: a pass that changes a leaf drops its edge whitespace or takes a mark off that whitespace, and merging adds neither. + // Terminates: a pass that changes a leaf drops whitespace from the leaf's edge or takes a mark off that whitespace, and merging adds no whitespace or mark. for (let current = leaves; ; ) { const merged = withoutEdgeBreaks(mergeAdjacentText(current, joinsWhenEditorNormal)) let changed = false @@ -218,7 +218,6 @@ function edgeDepth(marks: readonly AdfMark[], neighbour: AdfNode | undefined, wh return kept === 0 && lineEdge ? undefined : kept } -// How many of the runs around a leaf holding `marks`, outermost first, hold `neighbour` too. function sharedRuns(marks: readonly AdfMark[], neighbour: AdfNode): number { let inside: RunNode | undefined = { node: neighbour, outer: 0 } for (const [depth, mark] of marks.entries()) {