10c - review: link and code span edges named in the README, 10e filed, leafEdges trail simplified
CI / gate (push) Successful in 40s
CI / publish (push) Has been skipped

This commit is contained in:
2026-09-26 13:26:20 +02:00
parent 613dc0edbb
commit f594dafc5b
4 changed files with 12 additions and 4 deletions
+2 -2
View File
@@ -221,9 +221,9 @@ function leafEdges(leaf: AdfNode, previous: AdfNode | undefined, next: AdfNode |
const text = leaf.text
if (text === undefined || marks.some((mark) => mark.type === 'code')) return undefined
const lead = text.slice(0, text.search(/[^ \t]|$/))
const trail = text.slice(Math.max(lead.length, text.search(/[ \t]*$/)))
const trail = text.slice(text.search(/[ \t]*$/))
const leadDepth = edgeDepth(marks, previous, lead)
const trailDepth = edgeDepth(marks, next, lead === text ? text : trail)
const trailDepth = edgeDepth(marks, next, trail)
if (leadDepth === marks.length && trailDepth === marks.length) return undefined
if (lead === text) return leadDepth === undefined || trailDepth === undefined ? [] : [textLeaf(text, marks.slice(0, Math.min(leadDepth, trailDepth)))]
const edges: AdfNode[] = []