3
0
mirror of https://github.com/larvit/adf-codec.git synced 2026-11-20 07:05:44 +01:00

Refuse a mark whose content is text and text breaks that the mark cannot hold

This commit is contained in:
2026-10-31 03:02:29 +01:00
committed by Lillem4n
parent 6d09da68c7
commit c4cbebd0e1
2 changed files with 2 additions and 1 deletions
+1 -1
View File
@@ -258,7 +258,7 @@ function directiveMarkPieces(scan: Scan, name: string, mark: AdfMark, slot: read
return failure('unsupported-node-shape', `the ${name} mark wraps the [content] it marks: this one wraps none`, scan.shared.path)
}
if (nodes.some(holdsOwnMarks)) return failure('unsupported-node-shape', ownMarksInMark, scan.shared.path)
if (!nodes.some((node) => marksItem(node, mark.type))) {
if (!nodes.some((node) => isNode(node) && marksItem(node, mark.type))) {
const fix = mark.type === 'border' ? 'only a mediaInline takes border: delete the border spelling' : `write the ${name} mark around text beside them`
return failure('unsupported-node-shape', `the ${name} mark wraps the [content] it marks: this one wraps only nodes that take no ${name} mark: ${fix}`, scan.shared.path)
}