File tree Expand file tree Collapse file tree 3 files changed +35
-1
lines changed Expand file tree Collapse file tree 3 files changed +35
-1
lines changed Original file line number Diff line number Diff line change
1
+ Test nested syntax highlighting
2
+
3
+ ```` md hi.md
4
+ # Hi
5
+
6
+ ```js
7
+ export default {
8
+ data() {
9
+ return {
10
+ greeting: "Hello World!",
11
+ }
12
+ },
13
+ }
14
+ ```
15
+
16
+ [lorem](https://loremipsum.com)
17
+ ````
18
+
19
+ ``` js hi.js
20
+ export default {
21
+ data () {
22
+ return {
23
+ greeting: " Hello World!" ,
24
+ }
25
+ },
26
+ }
27
+ ```
Original file line number Diff line number Diff line change 34
34
"scripts" : {
35
35
"dev" : " next" ,
36
36
"build" : " rollup -c rollup.config.js" ,
37
+ "watch" : " rollup --watch -c rollup.config.js" ,
37
38
"test" : " vitest" ,
38
39
"coverage" : " vitest run --coverage"
39
40
},
Original file line number Diff line number Diff line change @@ -33,11 +33,17 @@ export async function highlight({
33
33
}
34
34
}
35
35
if ( highlighterPromise === null ) {
36
+ const isBrowser = typeof window !== "undefined"
37
+ // if we are on the server we load all the languages
38
+ // if we are on the browser just load the first language
39
+ // subsequent calls with different languages will lazy load
40
+ const langs = isBrowser ? [ lang as Lang ] : undefined
41
+
36
42
// TODO add version
37
43
setCDN ( "https://unpkg.com/shiki/" )
38
44
highlighterPromise = getHighlighter ( {
39
45
theme : theme as IShikiTheme ,
40
- // langs: [lang as Lang], // TODO change lang from string to Lang
46
+ langs,
41
47
} )
42
48
}
43
49
You can’t perform that action at this time.
0 commit comments