Skip to content

Commit 6308668

Browse files
⚡ Update
1 parent df58d8e commit 6308668

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/class/HTMLCodeBlockElement.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default class HTMLCodeBlockElement extends HTMLElement {
77
* you need to assign it directly to `HTMLCodeBlockElement.endgine`.
88
* Currently, only highlight.js is assumed.
99
*/
10-
static endgine: HLJSApi;
10+
static endgine: any;
1111

1212
/**
1313
* Returns the result of highlighting the received source code string.
@@ -17,7 +17,7 @@ export default class HTMLCodeBlockElement extends HTMLElement {
1717
*/
1818
static highlight(
1919
src: string,
20-
options: HighlightOptions,
20+
options?: HighlightOptions,
2121
): {
2222
value: string,
2323
} {
@@ -27,18 +27,20 @@ export default class HTMLCodeBlockElement extends HTMLElement {
2727
throw new Error('The syntax highlighting engine is not set to `HTMLCodeBlockElement.endgine`.');
2828
}
2929

30+
const hljs: HLJSApi = endgine;
31+
3032
if (
3133
// Verifying the existence of a language
3234
options?.language &&
33-
endgine.getLanguage(options.language)
35+
hljs.getLanguage(options.language)
3436
) {
35-
return endgine.highlight(
37+
return hljs.highlight(
3638
src,
3739
options,
3840
);
3941
}
4042

41-
return endgine.highlightAuto(src);
43+
return hljs.highlightAuto(src);
4244
}
4345

4446
#slots = (() => {

0 commit comments

Comments
 (0)