Skip to content

Commit

Permalink
fix: prevent deprecation warnings with highlight.js v10.7 (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
loriswit authored Mar 28, 2021
1 parent 151dfed commit 01b7e45
Show file tree
Hide file tree
Showing 4 changed files with 229 additions and 244 deletions.
12 changes: 3 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
"homepage": "https://github.com/felixfbecker/cli-highlight#readme",
"dependencies": {
"chalk": "^4.0.0",
"highlight.js": "^10.0.0",
"highlight.js": "^10.7.1",
"mz": "^2.4.0",
"parse5": "^5.1.1",
"parse5-htmlparser2-tree-adapter": "^6.0.0",
Expand All @@ -111,7 +111,6 @@
"@eclass/semantic-release-surge": "^1.0.7",
"@sourcegraph/eslint-config": "^0.20.16",
"@sourcegraph/prettierrc": "^3.0.3",
"@types/highlight.js": "^9.12.1",
"@types/jest": "^24.0.9",
"@types/mz": "0.0.32",
"@types/node": "^14.14.9",
Expand Down
10 changes: 1 addition & 9 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,6 @@ export interface HighlightOptions {
*/
ignoreIllegals?: boolean

/**
* The continuation is an optional mode stack representing unfinished parsing. When present,
* the function will restart parsing from this state instead of initializing a new one.
*
* See http://highlightjs.readthedocs.io/en/latest/api.html
*/
continuation?: any

/**
* Optional array of language names and aliases restricting detection to only those languages.
*/
Expand Down Expand Up @@ -94,7 +86,7 @@ export interface HighlightOptions {
export function highlight(code: string, options: HighlightOptions = {}): string {
let html: string
if (options.language) {
html = hljs.highlight(options.language, code, options.ignoreIllegals, options.continuation).value
html = hljs.highlight(code, { language: options.language, ignoreIllegals: options.ignoreIllegals }).value
} else {
html = hljs.highlightAuto(code, options.languageSubset).value
}
Expand Down
Loading

0 comments on commit 01b7e45

Please sign in to comment.