@@ -2,7 +2,7 @@ import * as React from 'react'
22import { FaRegCopy } from 'react-icons/fa'
33import { MarkdownLink } from '~/components/MarkdownLink'
44import type { HTMLProps } from 'react'
5- import { createHighlighter as shikiGetHighlighter } from 'shiki/bundle-full .mjs'
5+ import { createHighlighter as shikiGetHighlighter } from 'shiki/bundle-web .mjs'
66import { transformerNotationDiff } from '@shikijs/transformers'
77import parse , {
88 attributesToProps ,
@@ -139,10 +139,10 @@ export function CodeBlock({
139139 const [ codeElement , setCodeElement ] = React . useState (
140140 < >
141141 < pre ref = { ref } className = { `shiki github-light h-full` } >
142- < code > { code } </ code >
142+ < code > { lang === 'mermaid' ? < svg /> : code } </ code >
143143 </ pre >
144144 < pre className = { `shiki tokyo-night` } >
145- < code > { code } </ code >
145+ < code > { lang === 'mermaid' ? < svg /> : code } </ code >
146146 </ pre >
147147 </ >
148148 )
@@ -158,7 +158,7 @@ export function CodeBlock({
158158 const htmls = await Promise . all (
159159 themes . map ( async ( theme ) => {
160160 const output = highlighter . codeToHtml ( code , {
161- lang,
161+ lang : lang === 'mermaid' ? 'plaintext' : lang ,
162162 theme,
163163 transformers : [ transformerNotationDiff ( ) ] ,
164164 } )
@@ -267,7 +267,11 @@ const getHighlighter = cache(async (language: string, themes: string[]) => {
267267
268268 let promises = [ ]
269269 if ( ! loadedLanguages . includes ( language as any ) ) {
270- promises . push ( highlighter . loadLanguage ( language as any ) )
270+ promises . push (
271+ highlighter . loadLanguage (
272+ language === 'mermaid' ? 'plaintext' : ( language as any )
273+ )
274+ )
271275 }
272276
273277 for ( const theme of themes ) {
0 commit comments