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

Answer principles round 1: 3 🔴, 8 🟡 (0 misread); attributes as data-*, carried content as paragraphs, links and notes, no character HTML cannot hold, mutants killed

This commit is contained in:
2026-10-23 19:19:14 +02:00
committed by Lillem4n
parent 1f46111fe4
commit 7a38db2563
27 changed files with 612 additions and 295 deletions
+2 -2
View File
@@ -1,12 +1,12 @@
import type { AdfNode } from '../../adf/document.ts'
import type { WrittenFlavour } from '../flavour.ts'
import { attrsDefinition } from '../mark-spellings.ts'
import { plainImage } from '../../adf/plain-image.ts'
import { toLinkDefinition } from '../mark-spellings.ts'
import { tryImageLine } from './inline-line.ts'
export function tryImage(node: AdfNode, flavour: WrittenFlavour): string | undefined {
const image = plainImage(node)
if (image === undefined) return undefined
const { alt, link, url } = image
return tryImageLine(alt, url, flavour, link === undefined ? undefined : attrsDefinition(link))
return tryImageLine(alt, url, flavour, link === undefined ? undefined : toLinkDefinition(link))
}