mirror of
https://github.com/larvit/adf-codec.git
synced 2026-11-13 12:18:28 +01:00
Answer stability round 1: tryImage drops an exit the comparison already takes, the README and changelog scope the linked image, and item 101 files the refusal naming its spelling
This commit is contained in:
@@ -12,7 +12,6 @@ export function tryImage(node: AdfNode): string | undefined {
|
||||
if (typeof url !== 'string' || (alt !== undefined && typeof alt !== 'string')) return undefined
|
||||
const [mark] = nodeMarks(media)
|
||||
const link = mark === undefined ? undefined : linkDefinition(nodeAttrs(mark))
|
||||
if (mark !== undefined && link === undefined) return undefined
|
||||
const read = centeredImage([externalMedia(alt ?? '', url, link)])
|
||||
return serializeCanonicalJson(node, 'compact') === serializeCanonicalJson(read, 'compact') ? tryImageLine(alt, url, link) : undefined
|
||||
}
|
||||
|
||||
@@ -68,7 +68,6 @@ export function tryPipeCell(nodes: readonly AdfNode[], path: ConvertErrorPath, f
|
||||
return emitted.value.line
|
||||
}
|
||||
|
||||
// `link` wraps the image as the link's whole text: `[](href)`.
|
||||
export function tryImageLine(alt: string | undefined, url: string, link?: LinkDefinition): string | undefined {
|
||||
if (alt !== undefined && (/^[ \t]|[ \t]$|[\n\r]/.test(alt) || holdsNullCharacter(alt))) return undefined
|
||||
const destination = spellDestination(url)
|
||||
|
||||
Reference in New Issue
Block a user