3
0
mirror of https://github.com/larvit/adf-codec.git synced 2026-11-21 15:42:58 +01:00

Answer architecture round 1: 1 🔴, 2 🟡; keep the (image) trailer out of alt text, refuse a node slot holding an image inside a link

This commit is contained in:
2026-10-22 22:24:57 +02:00
committed by Lillem4n
parent e82998c322
commit 78104b6746
4 changed files with 53 additions and 40 deletions
+5
View File
@@ -12,3 +12,8 @@ export function externalMedia(alt: string, url: string, link?: LinkDefinition):
const media: AdfNode = { attrs: alt === '' ? { type: 'external', url } : { alt, type: 'external', url }, type: 'media' }
return link === undefined ? media : { ...media, marks: [linkMark(link)] }
}
// spec/flavour.md, The CommonMark image: the ` (image)` standing after a link for an image inside it, `image` built by `link`.
export function imageAside(link: (text: string) => AdfNode[]): AdfNode[] {
return [{ text: ' (', type: 'text' }, ...link('image'), { text: ')', type: 'text' }]
}