3
0
mirror of https://github.com/larvit/adf-codec.git synced 2026-11-21 23:46:21 +01:00

Answer prose round 3: the comments on highlight pairing, escaped backtick lengths and the memo read once, and the Raw HTML paragraph loses its half clause

This commit is contained in:
2026-10-04 23:03:11 +02:00
committed by Lillem4n
parent 1ff27164f8
commit 1b55e0f528
4 changed files with 7 additions and 7 deletions
+2 -2
View File
@@ -121,10 +121,10 @@ function claimsHighlight(scan: string, index: number): boolean {
return flanking.opens || flanking.closes
}
// CommonMark reads no escape inside a code span, so a backtick string an escape forms or splits off still closes one an earlier bare run opens.
// CommonMark reads no escape inside a code span, so a backtick string left beside an escape still closes a span that an earlier bare run of its length opens.
function escapeClosedRuns(scan: string, escapings: readonly InlineEscaping[], claimed: ReadonlySet<number>): ReadonlySet<number> {
const escaped = new Set(claimed)
// The lengths of the backtick strings an escape forms or splits off: a bare run that long closes the span one opens.
// The lengths of the backtick strings escapes leave: a bare run of one of these lengths would open a span one of them closes, so it is escaped too.
const formed = new Set<number>()
let end = scan.length - 1
while (end >= 0) {