mirror of
https://github.com/larvit/adf-codec.git
synced 2026-11-14 12:30:26 +01:00
Answer architecture round 3: a link alone holding a titled image keeps its caption, and the decision's title names []()
This commit is contained in:
@@ -1014,6 +1014,8 @@ test('reads a titled image alone in its paragraph as the image captioned with it
|
||||
test('reads an image alone in a link as the image the link marks, and the link a title gives as its own', () => {
|
||||
const linked = (node: AdfNode, mark: AdfMark): AdfNode => ({ ...node, content: (node.content ?? []).map((media) => ({ ...media, marks: [mark] })) })
|
||||
assert.deepEqual(content(losslessMarkdownToAdf('[](/v "t")\n')), [linked(image('/u', 'a'), link('/v', 't'))])
|
||||
const captioned = linked(image('/u', 'a'), link('/v'))
|
||||
assert.deepEqual(content(losslessMarkdownToAdf('[](/v)\n')), [{ ...captioned, content: [...(captioned.content ?? []), { content: [text('c')], type: 'caption' }] }])
|
||||
assert.deepEqual(content(losslessMarkdownToAdf('[![a][i]][v]\n\n[i]: /u\n[v]: /v\n')), [linked(image('/u', 'a'), link('/v'))])
|
||||
assert.deepEqual(content(losslessMarkdownToAdf('[[](/v)](/w)\n')), [{ content: [text('['), marked('a', link('/v')), text('](/w)')], type: 'paragraph' }])
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user