mirror of
https://github.com/larvit/adf-codec.git
synced 2026-11-12 19:58:28 +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:
@@ -25,7 +25,7 @@ In `docs/decisions.md`:
|
||||
- CommonMark is a subset
|
||||
- Tables
|
||||
- Links
|
||||
- Every CommonMark image and empty link reads: the image where it stands alone, else a link
|
||||
- Every CommonMark image and empty link reads: the image where it stands alone, else a link, `[]()` as nothing
|
||||
- Ids stay site-local
|
||||
- Portable task ids come from position
|
||||
- A callout title keeps its link targets
|
||||
|
||||
@@ -245,9 +245,10 @@ Serves Goals 1, 4 and 5.
|
||||
`[]()` as nothing.
|
||||
- An image anywhere but alone in a plain paragraph reads as its alt text linked to its URL,
|
||||
`See .` as `See [the moon](moon.png).`, and inside a link as plain text
|
||||
the link marks.
|
||||
- An image's title reads as its caption where the image stands alone in a plain paragraph, as
|
||||
its link's title where it reads as alt text linked to its URL, and inside a link it drops.
|
||||
the link marks — unless the link's whole text is the image and the link stands alone in a
|
||||
plain paragraph, which reads as the image the link marks.
|
||||
- An image's title reads as its caption where the image reads as an image, as its link's title
|
||||
where it reads as alt text linked to its URL, and inside a link otherwise it drops.
|
||||
|
||||
And three more: a list continuing past a marker change stays one list against CommonMark's two,
|
||||
a shortcut reference matching its definition only under Unicode case folding stays unresolved,
|
||||
|
||||
+1
-1
@@ -202,7 +202,7 @@ link reference definition — and a directive link CommonMark could spell is ref
|
||||
link — the bracket form goes literal, the directive form refused — which is CommonMark's prose
|
||||
where its reference implementation nests one `<a>` in another.
|
||||
|
||||
## Every CommonMark image and empty link reads: the image where it stands alone, else a link
|
||||
## Every CommonMark image and empty link reads: the image where it stands alone, else a link, `[]()` as nothing
|
||||
|
||||
2026-10-04, the maintainer and a writer panel, 3 of 3; `[]()` 2026-10-09, settled by Goals 4 and 7
|
||||
as the maintainer's plan item directed. Goals 4, 5, 6 and 7. Valid while `mediaInline` carries no
|
||||
|
||||
@@ -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