Refuse a fence info string that decodes to the reserved carry name
CI / gate (push) Successful in 5s

This commit is contained in:
2026-08-26 16:54:22 +02:00
parent cbacf5d598
commit 6f32c6fc61
4 changed files with 8 additions and 3 deletions
+4 -1
View File
@@ -7,7 +7,7 @@ import { emitInlineLine } from './markdown-inline.ts'
import { tryPipeTable } from './markdown-pipe-table.ts'
import { carriedBlock, carryName } from './opaque-carry.ts'
import { failure, success, type ConvertErrorPath, type Result } from './result.ts'
import { holdsNullCharacter, isThematicBreak } from './commonmark-grammar.ts'
import { holdsEntityReference, holdsNullCharacter, isThematicBreak } from './commonmark-grammar.ts'
import { isAdfDocument } from './adf-document.ts'
import { largestNesting } from './nesting.ts'
import { fencedCodeBlock } from './backtick-runs.ts'
@@ -187,6 +187,9 @@ function spellCodeFenceInfo(language: JsonValue | undefined, path: ConvertErrorP
if (/[`\n\r]/.test(language) || language !== language.trim()) {
return failure('unspellable-code-block-language', 'a fence info string holds no backtick and no edge whitespace', path)
}
if (holdsEntityReference(language)) {
return failure('unspellable-code-block-language', 'a fence info string shaped like an entity reference decodes on the way back', path)
}
return success(language)
}