File tree Expand file tree Collapse file tree 1 file changed +9
-10
lines changed
src/node/markdown/plugins Expand file tree Collapse file tree 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(
6565 codeTransformers : userTransformers = [ ]
6666 } = options
6767
68- const usingTwoslash = userTransformers . some (
69- ( { name } ) => name === '@shikijs/vitepress-twoslash'
70- )
71-
7268 const highlighter = await createHighlighter ( {
7369 themes :
7470 typeof theme === 'object' && 'light' in theme && 'dark' in theme
7571 ? [ theme . light , theme . dark ]
7672 : [ theme ] ,
7773 langs : [
7874 ...( 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 || { } )
8576 ] ,
8677 langAlias : options . languageAlias
8778 } )
@@ -99,6 +90,14 @@ export async function highlight(
9990 return true
10091 }
10192
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+
102101 await options ?. shikiSetup ?.( highlighter )
103102
104103 const transformers : ShikiTransformer [ ] = [
You can’t perform that action at this time.
0 commit comments