Name the position a directive name the other one spells belongs to
CI / gate (push) Successful in 8s

This commit is contained in:
2026-09-01 23:04:23 +02:00
parent 1429f4ce3c
commit 5defa89b8d
7 changed files with 55 additions and 4 deletions
+7
View File
@@ -1,4 +1,5 @@
import type { AdfMark } from '../../adf/document.ts'
import type { ConvertFault } from '../../result.ts'
import type { DirectiveAttributes } from '../directive-syntax.ts'
import type { MarkSpelling } from '../mark-spellings.ts'
import { failure, success, type ConvertErrorPath, type Result } from '../../result.ts'
@@ -15,6 +16,12 @@ export function readDirectiveMark(name: string, attributes: DirectiveAttributes,
return success(Object.keys(attrs.value).length === 0 ? { type: name } : { attrs: attrs.value, type: name })
}
export function markSpellingFault(name: string): ConvertFault | undefined {
const spelling = markSpelling(name)
if (spelling === undefined) return undefined
return { code: 'unsupported-node-shape', message: `${name} is spelled ${markdownForm(spelling) ?? `:${name}[…]`}, never as a block directive` }
}
function markdownForm(spelling: MarkSpelling): string | undefined {
switch (spelling.kind) {
case 'code':