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

Answer architecture round 5: 0 🔴, 0 🟡 (0 misread); shownImage returns no textless state, item 143 and the card rule name their whole reach

This commit is contained in:
2026-10-26 12:58:17 +01:00
committed by Lillem4n
parent 9ff53c1658
commit e20a1c3a30
6 changed files with 23 additions and 19 deletions
+4 -4
View File
@@ -55,11 +55,11 @@ function shownPiece(node: AdfNode, lineFeed: string): string {
return linkedText(node, shownText(node), shownUrl(node), lineFeed)
}
// As portable markdown writes it inline, except that a link around a note stays (docs/decisions.md §The HTML dialect).
// As portable markdown writes it inline, except that a link around a note stays and an image's own `text`, outside ADF's schema, shows first (docs/decisions.md §The HTML dialect).
function linkedImage(media: AdfNode, lineFeed: string): string {
const { after, link, text } = shownImage(media, shownLink(media)?.href)
const shown = linkedText(media, text, link, lineFeed)
return after === undefined ? shown : `${shown} (${linked('image', { href: after })})`
const image = shownImage(media, shownLink(media)?.href)
const shown = linkedText(media, image?.text, image?.link, lineFeed)
return image?.after === undefined ? shown : `${shown} (${linked('image', { href: image.after })})`
}
function linkedText(node: AdfNode, standIn: string | undefined, url: string | undefined, lineFeed: string): string {