fix(ui): preserve code spans adjacent to tildes (#35835)

This commit is contained in:
Luke Parker
2026-07-14 10:02:30 +10:00
committed by GitHub
parent bb31c9b92c
commit 9a51765bd2
5 changed files with 39 additions and 3 deletions
@@ -0,0 +1,17 @@
import type { MarkedExtension } from "marked"
// Keep adjacent tilde and backtick runs separate until markedjs/marked#4011 is released.
export const markedCodeSpanBoundary = {
tokenizer: {
inlineText(src) {
const match = /^(`+(?=~)|~+(?=`))/.exec(src)
if (!match) return false
return {
type: "text",
raw: match[0],
text: match[0],
escaped: this.lexer.state.inRawBlock,
}
},
},
} satisfies MarkedExtension