Skip to content

Commit 5aaf1dd

Browse files
fix(ui): force wasm highlighter for markdown code blocks (#17373)
1 parent f5f0731 commit 5aaf1dd

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

packages/ui/src/context/marked.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,11 @@ async function highlightCodeBlocks(html: string): Promise<string> {
428428
const matches = [...html.matchAll(codeBlockRegex)]
429429
if (matches.length === 0) return html
430430

431-
const highlighter = await getSharedHighlighter({ themes: ["OpenCode"], langs: [] })
431+
const highlighter = await getSharedHighlighter({
432+
themes: ["OpenCode"],
433+
langs: [],
434+
preferredHighlighter: "shiki-wasm",
435+
})
432436

433437
let result = html
434438
for (const match of matches) {
@@ -479,7 +483,11 @@ export const { use: useMarked, provider: MarkedProvider } = createSimpleContext(
479483
}),
480484
markedShiki({
481485
async highlight(code, lang) {
482-
const highlighter = await getSharedHighlighter({ themes: ["OpenCode"], langs: [] })
486+
const highlighter = await getSharedHighlighter({
487+
themes: ["OpenCode"],
488+
langs: [],
489+
preferredHighlighter: "shiki-wasm",
490+
})
483491
if (!(lang in bundledLanguages)) {
484492
lang = "text"
485493
}

0 commit comments

Comments
 (0)