File tree 1 file changed +9
-10
lines changed
src/node/markdown/plugins
1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -65,23 +65,14 @@ export async function highlight(
65
65
codeTransformers : userTransformers = [ ]
66
66
} = options
67
67
68
- const usingTwoslash = userTransformers . some (
69
- ( { name } ) => name === '@shikijs/vitepress-twoslash'
70
- )
71
-
72
68
const highlighter = await createHighlighter ( {
73
69
themes :
74
70
typeof theme === 'object' && 'light' in theme && 'dark' in theme
75
71
? [ theme . light , theme . dark ]
76
72
: [ theme ] ,
77
73
langs : [
78
74
...( options . languages || [ ] ) ,
79
- ...Object . values ( options . languageAlias || { } ) ,
80
-
81
- // patch for twoslash - https://github.com/vuejs/vitepress/issues/4334
82
- ...( usingTwoslash
83
- ? Object . keys ( ( await import ( 'shiki' ) ) . bundledLanguages )
84
- : [ ] )
75
+ ...Object . values ( options . languageAlias || { } )
85
76
] ,
86
77
langAlias : options . languageAlias
87
78
} )
@@ -99,6 +90,14 @@ export async function highlight(
99
90
return true
100
91
}
101
92
93
+ // patch for twoslash - https://github.com/vuejs/vitepress/issues/4334
94
+ const internal = highlighter . getInternalContext ( )
95
+ const getLanguage = internal . getLanguage
96
+ internal . getLanguage = ( name ) => {
97
+ loadLanguage ( name )
98
+ return getLanguage . call ( internal , name )
99
+ }
100
+
102
101
await options ?. shikiSetup ?.( highlighter )
103
102
104
103
const transformers : ShikiTransformer [ ] = [
You can’t perform that action at this time.
0 commit comments