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

Answer principles round 1: 1 🔴, 0 🟡 (0 misread); readDestination reads through targetMemo, so one loop holds the destination grammar

This commit is contained in:
2026-10-28 12:05:33 +01:00
committed by Lillem4n
parent fc7f7fb357
commit 167d59836c
3 changed files with 15 additions and 23 deletions
+2 -2
View File
@@ -4,7 +4,7 @@ import type { Claims, Flavour } from '../flavour.ts'
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, TargetMemo } from '../commonmark/link-syntax.ts'
import type { InlineTarget, LinkDefinition, TargetMemo } from '../commonmark/link-syntax.ts'
import { centeredImage, externalMedia } from '../../adf/plain-image.ts'
import { commonMarkLink, linkDefinition, linkHref, linkMark, toLinkAttrs } from '../mark-spellings.ts'
import { decodeTextEscapes, trimTrailingSpace } from '../commonmark/grammar.ts'
@@ -427,7 +427,7 @@ function bracketNodes(bracket: Bracket | OpenBracket): AdfNode[] {
return [{ text: bracket.image ? '![' : '[', type: 'text' }]
}
function resolveTarget(scan: Scan, start: number, index: number): { definition: () => LinkDefinition; length: number } | undefined {
function resolveTarget(scan: Scan, start: number, index: number): InlineTarget | undefined {
const after = index + 1
if (scan.source.charAt(after) === '(') {
scan.targets ??= targetMemo(scan.source)