3
0
mirror of https://github.com/larvit/adf-codec.git synced 2026-11-20 23:25:43 +01:00

Answer stability round 3: a link directive holding a joined hard break falls back to parting it

This commit is contained in:
2026-10-09 11:32:38 +02:00
parent ecfcdcd4f0
commit b4f8c042e6
3 changed files with 7 additions and 2 deletions
+2
View File
@@ -327,6 +327,8 @@ function emitMarkedRun(nodes: readonly AdfNode[], mark: AdfMark, depth: number,
const inner = emitRun(nodes, depth + 1, index, { ...context, bracketed: true })
if (!inner.ok) return inner
if (inner.value.carry !== undefined) return inner
// A link `tryLink` gave back holds the hard breaks `joinsRun` joined; the carry's fallback parts them.
if (inner.value.segments.some((segment) => segment.text.includes('\n'))) return success({ carry: range })
return success({ segments: [syntax(spellInlineDirectiveOpener(mark.type)), ...inner.value.segments, syntax(`]${attributes}`)] })
}