From fb78063f127a5a2300d77d0c49f2783e0bce92c1 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Sat, 3 Oct 2026 15:05:51 +0200 Subject: [PATCH] Name the code block wrapper in the two carry-fence refusals that lacked it --- src/markdown/opaque-carry.ts | 4 ++-- src/markdown/parse/markdown-to-adf.test.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/markdown/opaque-carry.ts b/src/markdown/opaque-carry.ts index 90bd538..1c2a218 100644 --- a/src/markdown/opaque-carry.ts +++ b/src/markdown/opaque-carry.ts @@ -39,7 +39,7 @@ export function carryFenceType(info: string): string | undefined { export function readCarriedBlock(type: string, body: string, depth: number): Read { if (type !== '' && !infoStringCarries(type)) { - return { fault: unsupportedNodeShape(`the carry fence names a type no info string carries back: spell it ${carryFencePrefix} with the type in the JSON`) } + return { fault: unsupportedNodeShape(`the carry fence names a type no info string carries back: spell it ${carryFencePrefix} with the type in the JSON; ${fenceEscape(type)}`) } } const read = readCarriedJson(body, 'two-space', largestNesting - depth, type) if (read.fault !== undefined || type !== '' || !infoStringCarries(read.value.type)) return read @@ -89,7 +89,7 @@ function fenceEscape(type: string): string { function typedValue(value: JsonValue, type: string): Read { if (value === null || typeof value !== 'object' || Array.isArray(value)) return { value } - if ('type' in value) return { fault: unsupportedNodeShape(`the ${carryFencePrefix}${type} fence names its node's type: this JSON holds a type as well`) } + if ('type' in value) return { fault: unsupportedNodeShape(`the ${carryFencePrefix}${type} fence names its node's type: this JSON holds a type as well; ${fenceEscape(type)}`) } return { value: { ...value, type } } } diff --git a/src/markdown/parse/markdown-to-adf.test.ts b/src/markdown/parse/markdown-to-adf.test.ts index 2c72bfe..d121624 100644 --- a/src/markdown/parse/markdown-to-adf.test.ts +++ b/src/markdown/parse/markdown-to-adf.test.ts @@ -374,11 +374,11 @@ test('reads the carry fence back to the node its info string names and its JSON assert.deepEqual(content(markdownToAdf('```adf:\n{\n "type": "a`b"\n}\n```\n')), [{ type: 'a`b' }]) assert.equal( content(markdownToAdf('```adf:blockCard\n{\n "type": "blockCard"\n}\n```\n')), - "unsupported-node-shape: the adf:blockCard fence names its node's type: this JSON holds a type as well", + 'unsupported-node-shape: the adf:blockCard fence names its node\'s type: this JSON holds a type as well; !adf:codeBlock {language="adf:blockCard"} around a bare fence keeps it a code block', ) assert.equal(content(markdownToAdf('```adf:\n{\n "type": "blockCard"\n}\n```\n')), 'unsupported-node-shape: the carry fence names a type its info string carries: spell it adf:blockCard') assert.equal(content(markdownToAdf('```adf:\n{}\n```\n')), "unsupported-node-shape: the opaque carry holds one ADF node's JSON: this JSON is no ADF node; !adf:codeBlock {language=\"adf:\"} around a bare fence keeps it a code block") - const unnamed = 'unsupported-node-shape: the carry fence names a type no info string carries back: spell it adf: with the type in the JSON' + const unnamed = 'unsupported-node-shape: the carry fence names a type no info string carries back: spell it adf: with the type in the JSON; !adf:codeBlock {language="adf:\\\\"} around a bare fence keeps it a code block' assert.equal(content(markdownToAdf('```adf:\\\\\n{}\n```\n')), unnamed) })