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

Answer stability round 1: 1 🔴, 4 🟡 (1 misread); a line gives up its first misread emphasis run, else its first misread highlight, as shipped, the run list narrows to one run, Scan holds SharedScan, the Piece arms are named, and textOpeners and guardLinkDefinition are pinned

This commit is contained in:
2026-10-28 17:36:28 +01:00
committed by Lillem4n
parent 6636f01497
commit b388b33d31
6 changed files with 83 additions and 70 deletions
@@ -384,6 +384,15 @@ test('drops the mark of a run CommonMark flanking or matching cannot spell', ()
assert.equal(portable(paragraph(text('a'), text('b', highlight), text(' c'), text('d', highlight), text(' '), text('e', highlight))), 'ab cd ==e==\n')
})
test('drops the mark of the run that cannot close where it sits, and keeps the later run the reader would pair it with', () => {
const highlight: AdfMark = { type: 'backgroundColor' }
const strike: AdfMark = { type: 'strike' }
assert.equal(portable(paragraph(text(':', em), text('b'), text('c', em))), ':b*c*\n')
assert.equal(portable(paragraph(text(')', strong), text('b'), text('c', strong))), ')b**c**\n')
assert.equal(portable(paragraph(text('^', strike), text('b'), text('c', strike))), '^b~~c~~\n')
assert.equal(portable(paragraph(text('~', highlight), text('b'), text('日本', highlight))), '~b==日本==\n')
})
test('breaks a line at a newline and trims whitespace at every edge CommonMark strips', () => {
assert.equal(portable(paragraph(text(' \n a \n b\n'))), 'a\\\nb\n')
assert.equal(portable(paragraph({ type: 'hardBreak' }, text('a'), { attrs: { text: '\n' }, type: 'hardBreak' }, text('b'), { type: 'hardBreak' })), 'a\\\nb\n')