mirror of
https://github.com/larvit/adf-codec.git
synced 2026-11-19 14:45:44 +01:00
Answer architecture round 2: the decision's title states it whole, an image's title drops inside a link, the readers refuse nesting past 500 levels, one owner for the empty-alt rule
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
import type { AdfNode } from '../adf/document.ts'
|
||||
|
||||
// spec/flavour.md, The CommonMark image: the shape `` reads to, and the only one written back as it.
|
||||
// spec/flavour.md, The CommonMark image: `` reads to `centeredImage([externalMedia(alt, url)])`, the only shape written back as it.
|
||||
export function centeredImage(content: AdfNode[]): AdfNode {
|
||||
return { attrs: { layout: 'center' }, content, type: 'mediaSingle' }
|
||||
}
|
||||
|
||||
// `` builds no `alt`, so a media holding an empty one takes the directive form.
|
||||
export function externalMedia(alt: string, url: string): AdfNode {
|
||||
return { attrs: alt === '' ? { type: 'external', url } : { alt, type: 'external', url }, type: 'media' }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user