3
0
mirror of https://github.com/larvit/adf-codec.git synced 2026-11-19 14:45:44 +01:00

Answer stability round 1: 1 🔴, 6 🟡 (0 misread); a carry refuses where the walk finds it, tests pin each batching guard, the changelog names the nested emphasis still quadratic, item 158 files it

This commit is contained in:
2026-10-29 16:19:12 +01:00
committed by Lillem4n
parent 1ff3ad6e9b
commit dd4ff03909
9 changed files with 89 additions and 19 deletions
+4 -1
View File
@@ -206,10 +206,13 @@ const positions = fc.letrec<Positions>((tie) => {
})
// Short texts under a few marks beside nodes only the carry spells: the lines where one misread or carried run sits beside another.
const emphasisStack = fc.uniqueArray(fc.constantFrom<AdfMark>({ type: 'em' }, { type: 'strike' }, { type: 'strong' }), { maxLength: 3, minLength: 2, selector: (held) => held.type })
const lineMark = fc.constantFrom<AdfMark>({ type: 'backgroundColor' }, { type: 'code' }, { type: 'em' }, { attrs: { href: 'u' }, type: 'link' }, { type: 'link' }, { type: 'odd' }, { type: 'strike' }, { type: 'strong' })
const lineMarks = fc.uniqueArray(lineMark, { maxLength: 3, selector: (held) => held.type })
const lineText = fc.string({ maxLength: 3, minLength: 1, unit: fc.constantFrom(' ', '(', '*', '-', '.', '0', '=', '[', '_', '`', 'a', 'un') })
const lineLeaf = fc.oneof(
{ arbitrary: fc.record({ marks: lineMarks, text: fc.string({ maxLength: 3, minLength: 1, unit: fc.constantFrom(' ', '*', '-', '.', '0', '=', '[', '_', '`', 'a', 'un') }) }).map((held): AdfNode => ({ ...held, type: 'text' })), weight: 8 },
{ arbitrary: fc.record({ marks: emphasisStack, text: lineText }).map((held): AdfNode => ({ ...held, type: 'text' })), weight: 4 },
{ arbitrary: fc.record({ marks: lineMarks, text: lineText }).map((held): AdfNode => ({ ...held, type: 'text' })), weight: 8 },
{ arbitrary: fc.constant<AdfNode>({ type: 'hardBreak' }), weight: 1 },
{ arbitrary: fc.record({ attrs: fc.constantFrom({ id: 'a' }, { id: 'a', odd: 'b' }), marks: lineMarks }).map((held): AdfNode => ({ ...held, type: 'mention' })), weight: 1 },
)