mirror of
https://github.com/larvit/adf-codec.git
synced 2026-11-20 23:25:43 +01:00
Answer stability round 1: 0 🔴, 4 🟡 (0 misread); cap the every mode alone, name the cap's steps, pin links and highlights at the cap
This commit is contained in:
@@ -226,7 +226,7 @@ function spellableLine(leaves: AdfNode[], container: LineContainer, path: Conver
|
||||
if (fallback.value === undefined) return success(current)
|
||||
const fixed = withoutFallback(current, fallback.value, perPass)
|
||||
if (fixed === undefined) return failure('unsupported-node-shape', 'a portable line keeps a spelling that dropping a mark does not change', path)
|
||||
current = trimmedEdges(pass === readBackPasses ? fixed.map((leaf) => withMarks(leaf, nodeMarks(leaf).filter((mark) => !isEmphasis(mark)))) : fixed)
|
||||
current = trimmedEdges(perPass === 'every' && pass === readBackPasses ? withoutEmphasis(fixed) : fixed)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,6 +241,10 @@ function withoutFallback(leaves: readonly AdfNode[], fallback: PortableLineFallb
|
||||
return spans ? leaves.map((leaf, index) => (index > last ? leaf : withMarks(leaf, nodeMarks(leaf).filter((held) => held.type !== 'code')))) : undefined
|
||||
}
|
||||
|
||||
function withoutEmphasis(leaves: readonly AdfNode[]): AdfNode[] {
|
||||
return leaves.map((leaf) => withMarks(leaf, nodeMarks(leaf).filter((mark) => !isEmphasis(mark))))
|
||||
}
|
||||
|
||||
// The runs may nest, so a leaf drops the mark at every depth a run holds it.
|
||||
function withoutMarks(leaves: readonly AdfNode[], runs: readonly MarkRun[]): AdfNode[] {
|
||||
const depths = new Map<number, number[]>()
|
||||
|
||||
Reference in New Issue
Block a user