Skip to content

Commit

Permalink
Upgrade highlight.js call to non-deprecated form
Browse files Browse the repository at this point in the history
Following the dependency upgrade, when running the tests,
the highlight.js dependency printed this warning:

> 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

We address the deprecation by switching the call to the new form.
  • Loading branch information
espadrine committed Jul 14, 2023
1 parent 40f9b82 commit 9fea7d5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function latexPass(ast, options = {}) {

// Syntax highlighting.
} else if (hljsLang.includes(node.info)) {
const html = hljs.highlight(node.info, node.literal).value;
const html = hljs.highlight(node.literal, { language: node.info }).value;
const newNode = new Node('html_block', node.sourcepos);
newNode.literal = `<pre>${html}</pre>`;
node.insertBefore(newNode);
Expand All @@ -58,7 +58,7 @@ function latexPass(ast, options = {}) {
// Inline code highlighting.
} else if (hljsLang.includes(modifier)) {
html = '<code>'
+ hljs.highlight(modifier, node.literal).value
+ hljs.highlight(node.literal, { language: modifier }).value
+ '</code>';
}
if (html) {
Expand Down

0 comments on commit 9fea7d5

Please sign in to comment.