@@ -54,7 +54,6 @@ const highlighter = await createHighlighterCore({
54
54
import ( '@shikijs/langs/css' ) ,
55
55
import ( '@shikijs/langs/bash' ) ,
56
56
import ( '@shikijs/langs/yaml' ) ,
57
- import ( '@shikijs/langs/toml' ) ,
58
57
import ( '@shikijs/langs/svelte' )
59
58
] ,
60
59
engine : createOnigurumaEngine ( import ( 'shiki/wasm' ) )
@@ -235,14 +234,7 @@ export async function render_content_markdown(
235
234
236
235
if ( ( token . lang === 'js' || token . lang === 'ts' ) && check ) {
237
236
const match = / ( (?: [ \s \S ] + ) \/ \/ - - - c u t - - - \n ) ? ( [ \s \S ] + ) / . exec ( source ) ! ;
238
- // we need to ensure that the source content is separated from the
239
- // injected content by a '// @filename: ...' otherwise it will be
240
- // interpreted as the same file and prevent types from working
241
- [
242
- ,
243
- prelude = `${ source . includes ( '// @filename:' ) ? '' : '// @filename: dummy.' + token . lang } \n// ---cut---\n` ,
244
- source
245
- ] = match ;
237
+ [ , prelude = '// ---cut---\n' , source ] = match ;
246
238
247
239
const banner = twoslashBanner ?.( filename , source ) ;
248
240
if ( banner ) prelude = '// @filename: injected.d.ts\n' + banner + '\n' + prelude ;
@@ -765,7 +757,7 @@ async function syntax_highlight({
765
757
/** We need to stash code wrapped in `---` highlights, because otherwise TS will error on e.g. bad syntax, duplicate declarations */
766
758
const redactions : string [ ] = [ ] ;
767
759
768
- let redacted = source . replace ( / ( { 13 } (?: [ ^ ] [ ^ ] + ?) { 13 } ) / g, ( _ , content ) => {
760
+ const redacted = source . replace ( / ( { 13 } (?: [ ^ ] [ ^ ] + ?) { 13 } ) / g, ( _ , content ) => {
769
761
redactions . push ( content ) ;
770
762
return ' ' . repeat ( content . length ) ;
771
763
} ) ;
@@ -781,9 +773,7 @@ async function syntax_highlight({
781
773
compilerOptions : {
782
774
allowJs : true ,
783
775
checkJs : true ,
784
- // we always include the Svelte types because it's easier
785
- // than adding a reference when we detect a rune being used
786
- types : [ 'node' , 'svelte' ]
776
+ types : [ 'svelte' , '@sveltejs/kit' ]
787
777
}
788
778
} ,
789
779
// by default, twoslash does not run on .js files, change that through this option
@@ -870,7 +860,7 @@ async function syntax_highlight({
870
860
html = replace_blank_lines ( html ) ;
871
861
} else {
872
862
const highlighted = highlighter . codeToHtml ( source , {
873
- lang : SHIKI_LANGUAGE_MAP [ language as keyof typeof SHIKI_LANGUAGE_MAP ] ?? language ,
863
+ lang : SHIKI_LANGUAGE_MAP [ language as keyof typeof SHIKI_LANGUAGE_MAP ] ,
874
864
theme
875
865
} ) ;
876
866
@@ -894,7 +884,6 @@ async function syntax_highlight({
894
884
. replace ( / { 11 } ( [ ^ ] [ ^ ] + ?) { 11 } / g, ( _ , content ) => {
895
885
return highlight_spans ( content , 'highlight add' ) ;
896
886
} )
897
- // TODO: make this not highlight the static adapter's github yaml deploy file
898
887
. replace ( / { 9 } ( [ ^ ] [ ^ ] + ?) { 9 } / g, ( _ , content ) => {
899
888
return highlight_spans ( content , 'highlight' ) ;
900
889
} ) ;
0 commit comments