@@ -11,6 +11,10 @@ import { CodeCopy } from '../code-copy/code-copy';
11
11
import { getHighlighterCore } from 'shiki' ;
12
12
import { cn } from '@qwik-ui/utils' ;
13
13
import { isDev } from '@builder.io/qwik/build' ;
14
+ import poimandres from 'shiki/themes/poimandres.mjs' ;
15
+ import html from 'shiki/langs/html.mjs' ;
16
+ import css from 'shiki/langs/css.mjs' ;
17
+ import tsx from 'shiki/langs/tsx.mjs' ;
14
18
15
19
export type HighlightProps = PropsOf < 'div' > & {
16
20
code : string ;
@@ -31,11 +35,6 @@ export const Highlight = component$(
31
35
} : HighlightProps ) => {
32
36
const codeSig = useSignal ( '' ) ;
33
37
34
- useVisibleTask$ ( ( { track } ) => {
35
- track ( ( ) => codeSig . value ) ;
36
- console . log ( 'codeSig changed: ' , codeSig . value ) ;
37
- } ) ;
38
-
39
38
const addShiki$ = $ ( async ( ) => {
40
39
let modifiedCode : string = code ;
41
40
@@ -50,15 +49,8 @@ export const Highlight = component$(
50
49
}
51
50
52
51
const highlighter = await getHighlighterCore ( {
53
- themes : [
54
- // or a dynamic import if you want to do chunk splitting
55
- import ( 'shiki/themes/poimandres.mjs' ) ,
56
- ] ,
57
- langs : [
58
- import ( 'shiki/langs/html.mjs' ) ,
59
- import ( 'shiki/langs/tsx.mjs' ) ,
60
- import ( 'shiki/langs/css.mjs' ) ,
61
- ] ,
52
+ themes : [ poimandres ] ,
53
+ langs : [ html , css , tsx ] ,
62
54
loadWasm : import ( 'shiki/wasm' ) ,
63
55
} ) ;
64
56
@@ -87,7 +79,7 @@ export const Highlight = component$(
87
79
await addShiki$ ( ) ;
88
80
}
89
81
} ,
90
- { strategy : 'document-ready ' } ,
82
+ { strategy : 'intersection-observer ' } ,
91
83
) ;
92
84
93
85
return (
0 commit comments