10c - review: link and code span edges named in the README, 10e filed, leafEdges trail simplified
This commit is contained in:
@@ -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[] = []
|
||||
|
||||
Reference in New Issue
Block a user