mirror of
https://github.com/larvit/adf-codec.git
synced 2026-11-20 15:15:44 +01:00
Answer principles round 1: 0 🔴, 0 🟡 (0 misread); readAsWritten names the emphasis check, the bracket test names the bare case, noDefinitions sorts after linkInLink
This commit is contained in:
@@ -278,14 +278,18 @@ function unspellableRuns(placed: readonly PlacedSegment[], reading: InlineReadin
|
||||
if (segment.highlight === 'open') highlight = { nodes: segment.nodes, start }
|
||||
if (segment.emphasis === 'close') {
|
||||
const opener = openers.pop()
|
||||
const read = opener === undefined ? undefined : reading.emphasis.get(opener.start)
|
||||
if (opener !== undefined && (read?.closer !== start || read.width !== segment.text.length) && opener.start > (innermost?.start ?? -1)) innermost = opener
|
||||
if (opener !== undefined && !readAsWritten(reading, opener.start, start, segment.text.length) && opener.start > (innermost?.start ?? -1)) innermost = opener
|
||||
}
|
||||
if (segment.highlight === 'close' && highlight !== undefined && reading.highlights.get(highlight.start) !== start) unreadHighlights.push(highlight.nodes)
|
||||
}
|
||||
return innermost === undefined ? unreadHighlights : [innermost.nodes]
|
||||
}
|
||||
|
||||
function readAsWritten(reading: InlineReading, opener: number, closer: number, width: number): boolean {
|
||||
const read = reading.emphasis.get(opener)
|
||||
return read?.closer === closer && read.width === width
|
||||
}
|
||||
|
||||
function isEscapable(escaping: InlineEscaping | undefined): boolean {
|
||||
return escaping === 'backslash' || escaping === 'bracketed'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user