From 7d20f3e895e3ffe82ef51b56e8e2e10eeced2a62 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Tue, 15 Sep 2026 22:22:46 +0200 Subject: [PATCH] 4.3: the ADF generator draws backtick runs beside code spans, and the directive floor's message names what it counts --- src/markdown-property.test.ts | 2 +- src/property-harness.ts | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/markdown-property.test.ts b/src/markdown-property.test.ts index f5909b4..1778594 100644 --- a/src/markdown-property.test.ts +++ b/src/markdown-property.test.ts @@ -427,6 +427,6 @@ test('generated markdown refuses, or what it parses to refuses to emit, or its s ) if (!parameters.gate) return assert.ok(fixpoints >= fixpointFloor, `${fixpoints} of ${gateRuns} runs reached the fixpoint, under the floor of ${fixpointFloor}`) - assert.ok(directiveShaped >= directiveShapedFloor, `${directiveShaped} runs reaching the fixpoint held a node or mark only a directive or the carry spells, under the floor of ${directiveShapedFloor}`) + assert.ok(directiveShaped >= directiveShapedFloor, `${directiveShaped} runs reaching the fixpoint held a node or mark outside CommonMark's own types, under the floor of ${directiveShapedFloor}`) }) diff --git a/src/property-harness.ts b/src/property-harness.ts index 226f0f3..1f714ec 100644 --- a/src/property-harness.ts +++ b/src/property-harness.ts @@ -85,6 +85,10 @@ const marks = fc.uniqueArray(mark, { maxLength: 3, selector: (held) => held.type const textNode = fc.record({ marks, text }).map((held): AdfNode => ({ ...held, type: 'text' })) +const backtickRunNode = fc + .record({ marks: fc.oneof(fc.constant([]), fc.constant([{ type: 'code' }]), marks), text: fc.string({ maxLength: 6, minLength: 1, unit: fc.constantFrom('`', '``', ' ', 'a') }) }) + .map((held): AdfNode => ({ ...held, type: 'text' })) + const autolinkTextNode = fc .record({ href: fc.tuple(fc.constantFrom('ab:', 'http://'), textOf(0)).map(([scheme, rest]) => `${scheme}${rest}`), marks }) .map(({ href, marks: held }): AdfNode => ({ marks: [...held.filter((outer) => outer.type !== 'link'), { attrs: { href }, type: 'link' }], text: href, type: 'text' })) @@ -119,7 +123,7 @@ const positions = fc.letrec((tie) => { const leafBlocks = blockNodes.filter((entry) => entry.leaf).map((entry) => entry.node) const containerBlocks = blockNodes.filter((entry) => !entry.leaf).map((entry) => entry.node) const misplacedWeight = 7 - const paragraph = inlineContent.map((content): AdfNode => ({ content, type: 'paragraph' })) + const paragraph = fc.oneof({ arbitrary: inlineContent, weight: 3 }, { arbitrary: fc.array(backtickRunNode, { maxLength: 4, minLength: 2 }), weight: 1 }).map((content): AdfNode => ({ content, type: 'paragraph' })) const cell = (type: string) => paragraph.map((held): AdfNode => ({ content: [held], type })) const listItems = fc.array( blockContent.map((content): AdfNode => ({ content, type: 'listItem' })), @@ -150,6 +154,7 @@ const positions = fc.letrec((tie) => { { depthIdentifier, depthSize: 'small', maxDepth: 4 }, { arbitrary: textNode, weight: 12 }, { arbitrary: autolinkTextNode, weight: 2 }, + { arbitrary: backtickRunNode, weight: 3 }, { arbitrary: fc.oneof(...inlineNodes), weight: 7 }, { arbitrary: fc.oneof(...blockNodes.map((entry) => entry.node), unknownNode), weight: 2 }, ),