File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -98,9 +98,21 @@ export default function CodeTabs() {
9898
9999 useEffect ( ( ) => {
100100 const { code, lang } = FILES [ active ] ;
101- codeToHtml ( code , { lang, theme : "min-dark" } ) . then ( ( html ) => {
101+ // @ts -ignore
102+ import ( "https://unpkg.com/shiki@1.22.0/dist/index.mjs" )
103+ . then ( async ( shiki ) => {
104+ // pastikan pakai CDN untuk themes
105+ if ( shiki . setCDN ) shiki . setCDN ( "https://unpkg.com/shiki/" ) ;
106+ const html = await shiki . codeToHtml ( code , {
107+ lang,
108+ theme : "github-dark" , // atau 'dracula', bebas
109+ } ) ;
102110 const clean = html . replace ( / b a c k g r o u n d - c o l o r : [ ^ ; " ] + ; ? / g, "" ) ;
103111 setHighlighted ( clean ) ;
112+ } )
113+ . catch ( ( err ) => {
114+ console . error ( "Shiki load error:" , err ) ;
115+ setHighlighted ( `<pre>${ code } </pre>` ) ;
104116 } ) ;
105117 } , [ active ] ) ;
106118
You can’t perform that action at this time.
0 commit comments