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

Answer architecture round 1: 2 🔴, 6 🟡 (0 misread); one escaping path refusing null characters, block writers returning their pieces, the HTML writer split, shared entry checks, lint between formats

This commit is contained in:
2026-10-23 14:51:15 +02:00
committed by Lillem4n
parent cc029b0bc9
commit e234905c27
19 changed files with 324 additions and 269 deletions
+3 -3
View File
@@ -5,9 +5,9 @@ import type { EmphasisPairing } from '../commonmark/emphasis-matching.ts'
import type { InlineSource, InlineToken } from '../inline-tokens.ts'
import type { LineContainer } from '../line-container.ts'
import type { LinkDefinition } from '../commonmark/link-syntax.ts'
import { centeredImage, externalMedia } from '../../adf/external-image.ts'
import { centeredImage, externalMedia } from '../../adf/plain-image.ts'
import { imageAside } from '../image-aside.ts'
import { commonMarkLink, definitionTarget, linkDefinition, linkHref, linkMark } from '../mark-spellings.ts'
import { commonMarkLink, definitionAttrs, linkDefinition, linkHref, linkMark } from '../mark-spellings.ts'
import { decodeTextEscapes, trimTrailingSpace } from '../commonmark/grammar.ts'
import { failure, faulted, success, type ConvertErrorPath, type Result } from '../../result.ts'
import { flavourClaims } from '../flavour.ts'
@@ -319,7 +319,7 @@ function imageLink(definition: LinkDefinition): ImageLink {
function mediaSingle({ alt, definition, link }: Image): AdfNode {
const { title } = definition
const caption: AdfNode[] = title === undefined || title === '' ? [] : [{ content: [{ text: title, type: 'text' }], type: 'caption' }]
return centeredImage([externalMedia(alt, definition.destination, link === undefined ? undefined : definitionTarget(link)), ...caption])
return centeredImage([externalMedia(alt, definition.destination, link === undefined ? undefined : definitionAttrs(link)), ...caption])
}
// ADF holds no empty text node and a hard break takes no link, so the destination text carries the link ahead of the text's hard breaks; an empty destination leaves the breaks alone.