Skip to content

Commit 08c4352

Browse files
oburdasovoburdasov
andauthored
feat: fix highlight.js deprecation warning (#732)
Co-authored-by: oburdasov <[email protected]>
1 parent c9244cc commit 08c4352

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

tools/gulp/tasks/docs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const markdownOptions = {
5959
// highlight.js expects "typescript" written out, while Github supports "ts".
6060
const lang = language.toLowerCase() === 'ts' ? 'typescript' : language;
6161

62-
return hljs.highlight(lang, code).value;
62+
return hljs.highlight(code, {language: lang}).value;
6363
}
6464

6565
return code;

tools/highlight-files/highlight-code-block.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ const highlightJs = require('highlight.js');
88
*/
99
export function highlightCodeBlock(code: string, language: string) {
1010
if (language) {
11-
return highlightJs.highlight(
12-
language.toLowerCase() === 'ts' ? 'typescript' : language, code).value;
11+
return highlightJs.highlight(code, {
12+
language: language.toLowerCase() === 'ts' ? 'typescript' : language
13+
}).value;
1314
}
1415

1516
return code;

0 commit comments

Comments
 (0)