File tree Expand file tree Collapse file tree 3 files changed +23
-19
lines changed Expand file tree Collapse file tree 3 files changed +23
-19
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ title: Changelog
7
7
### Bug Fixes
8
8
9
9
- References to type aliases defined as mapped types will now correctly create a reference to the type alias, #2954 .
10
+ - ` ignoredHighlightLanguages ` can now be used to prevent warnings for codeblocks containing languages
11
+ which are supported by Shiki but are not loaded, #2956 .
10
12
11
13
## v0.28.4 (2025-05-04)
12
14
Original file line number Diff line number Diff line change @@ -88,21 +88,21 @@ export class MarkedPlugin extends ContextAwareRendererComponent {
88
88
lang = lang || "typescript" ;
89
89
lang = lang . toLowerCase ( ) ;
90
90
if ( ! isSupportedLanguage ( lang ) ) {
91
- this . application . logger . warn (
92
- i18n . unsupported_highlight_language_0_not_highlighted_in_comment_for_1 (
93
- lang ,
94
- getFriendlyFullName ( this . page ?. model || { name : "(unknown)" } ) ,
95
- ) ,
96
- ) ;
97
- return text ;
98
- }
99
- if ( ! isLoadedLanguage ( lang ) ) {
100
- this . application . logger . warn (
101
- i18n . unloaded_language_0_not_highlighted_in_comment_for_1 (
102
- lang ,
103
- getFriendlyFullName ( this . page ?. model || { name : "(unknown)" } ) ,
104
- ) ,
105
- ) ;
91
+ if ( isLoadedLanguage ( lang ) ) {
92
+ this . application . logger . warn (
93
+ i18n . unloaded_language_0_not_highlighted_in_comment_for_1 (
94
+ lang ,
95
+ getFriendlyFullName ( this . page ?. model || { name : "(unknown)" } ) ,
96
+ ) ,
97
+ ) ;
98
+ } else {
99
+ this . application . logger . warn (
100
+ i18n . unsupported_highlight_language_0_not_highlighted_in_comment_for_1 (
101
+ lang ,
102
+ getFriendlyFullName ( this . page ?. model || { name : "(unknown)" } ) ,
103
+ ) ,
104
+ ) ;
105
+ }
106
106
return text ;
107
107
}
108
108
Original file line number Diff line number Diff line change @@ -162,8 +162,12 @@ export async function loadHighlighter(
162
162
highlighter = new ShikiHighlighter ( hl , lightTheme , darkTheme ) ;
163
163
}
164
164
165
+ function isPlainLanguage ( lang : string ) {
166
+ return ignoredLanguages ?. includes ( lang ) || plaintextLanguages . includes ( lang ) ;
167
+ }
168
+
165
169
export function isSupportedLanguage ( lang : string ) {
166
- return ignoredLanguages ?. includes ( lang ) || getSupportedLanguages ( ) . includes ( lang ) ;
170
+ return isPlainLanguage ( lang ) || supportedLanguages . includes ( lang ) ;
167
171
}
168
172
169
173
export function getSupportedLanguages ( ) : string [ ] {
@@ -175,9 +179,7 @@ export function getSupportedThemes(): string[] {
175
179
}
176
180
177
181
export function isLoadedLanguage ( lang : string ) : boolean {
178
- return (
179
- isSupportedLanguage ( lang ) || highlighter ?. supports ( lang ) || false
180
- ) ;
182
+ return isPlainLanguage ( lang ) || highlighter ?. supports ( lang ) || false ;
181
183
}
182
184
183
185
export function highlight ( code : string , lang : string ) : string {
You can’t perform that action at this time.
0 commit comments