3
0
mirror of https://github.com/larvit/adf-codec.git synced 2026-11-19 06:35:44 +01:00

Build a hardBreak carrying no marks where a mark spelling spans a line break, in every reader

This commit is contained in:
2026-10-09 10:54:56 +02:00
committed by Lillem4n
parent 78655bcdc0
commit 3ff5c95f4c
9 changed files with 50 additions and 44 deletions
+2 -2
View File
@@ -669,10 +669,10 @@ function markType(character: string, used: number): string {
return used === 2 ? 'strong' : 'em'
}
// `*(*a*)*` builds one `em`: a node holds at most one mark of each type.
// `*(*a*)*` builds one `em`: a node holds at most one mark of each type. Atlassian's schema gives a hard break no marks.
function applyMark(nodes: readonly Inline[], mark: AdfMark): Inline[] {
return nodes.map((node) => {
if (!isNode(node)) return node
if (!isNode(node) || node.type === 'hardBreak') return node
const marks = nodeMarks(node)
return marks.some((carried) => carried.type === mark.type) ? node : { ...node, marks: [mark, ...marks] }
})