diff --git a/src/markdown/inline-content.ts b/src/markdown/inline-content.ts index 9af406d..1a5c852 100644 --- a/src/markdown/inline-content.ts +++ b/src/markdown/inline-content.ts @@ -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) } diff --git a/src/markdown/parse/markdown-to-adf.test.ts b/src/markdown/parse/markdown-to-adf.test.ts index 8fedf61..1320d19 100644 --- a/src/markdown/parse/markdown-to-adf.test.ts +++ b/src/markdown/parse/markdown-to-adf.test.ts @@ -931,6 +931,7 @@ test('gives an inline node no mark Atlassian\'s schema withholds from it', () => assert.equal(read('!adf:border[a]{color="#091e42" size=2}\n'), unborderable) assert.equal(read('_!adf:border[a]{color="#091e42" size=2}_\n'), unborderable) assert.equal(read('!adf:underline[!adf:border[a]{color="#091e42" size=2}]\n'), unborderable) + assert.equal(read('!adf:border[a!adf:textBreak{}b]{color="#091e42" size=2}\n'), unborderable) assert.equal(read('!adf:underline[!adf:mention[@A]{id=b1c2}]\n'), 'unsupported-node-shape: the underline mark wraps the [content] it marks: this one wraps only nodes that take no underline mark: write the underline mark around text beside them') assert.equal(read('!adf:underline[!adf:mediaInline{id=m1}]\n'), 'unsupported-node-shape: the underline mark wraps the [content] it marks: this one wraps only nodes that take no underline mark: write the underline mark around text beside them') assert.equal(read('!adf:link[!adf:status[Done]{color=green}]{collection=c href="/u"}\n'), 'unsupported-node-shape: the link mark wraps the [content] it marks: this one wraps only nodes that take no link mark: write the link mark around text beside them')