Skip to content

Commit

Permalink
build: fix deprecation warning from highlightjs
Browse files Browse the repository at this point in the history
Fixes the following deprecation warning that is logged by `highlightjs`:

```
Deprecated as of 10.7.0. highlight(lang, code, ...args) has been deprecated.
Deprecated as of 10.7.0. Please use highlight(code, options) instead.
highlightjs/highlight.js#2277
```
  • Loading branch information
trik committed Sep 23, 2021
1 parent e9a0d0e commit 6672bd0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
"gulp": "^4.0.2",
"gulp-cli": "^2.3.0",
"gulp-dart-sass": "^1.0.2",
"highlight.js": "^10.4.0",
"highlight.js": "^10.7.0",
"http-rewrite-middleware": "^0.1.6",
"husky": "^7.0.1",
"inquirer": "^8.0.0",
Expand Down
5 changes: 3 additions & 2 deletions tools/highlight-files/highlight-code-block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ const highlightJs = require('highlight.js');
*/
export function highlightCodeBlock(code: string, language: string) {
if (language) {
return highlightJs.highlight(
language.toLowerCase() === 'ts' ? 'typescript' : language, code).value;
return highlightJs.highlight(code, {
language: language.toLowerCase() === 'ts' ? 'typescript' : language
}).value;
}

return code;
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6858,7 +6858,7 @@ header-case@^2.0.4:
capital-case "^1.0.4"
tslib "^2.0.3"

highlight.js@^10.4.0:
highlight.js@^10.7.0:
version "10.7.3"
resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-10.7.3.tgz#697272e3991356e40c3cac566a74eef681756531"
integrity sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A==
Expand Down

0 comments on commit 6672bd0

Please sign in to comment.