Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.

Commit 5c550dd

Browse files
committed
refactor: #15 Update highlight.js major version
1 parent 2f61d05 commit 5c550dd

File tree

3 files changed

+22
-7
lines changed

3 files changed

+22
-7
lines changed

package-lock.json

Lines changed: 10 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"dependencies": {
3535
"@vueuse/core": "^4.7.0",
3636
"diff-match-patch": "^1.0.5",
37-
"highlight.js": "^10.5.0"
37+
"highlight.js": "^11.4.0"
3838
},
3939
"devDependencies": {
4040
"@babel/plugin-transform-runtime": "^7.12.1",
@@ -113,6 +113,10 @@
113113
{
114114
"type": "style",
115115
"release": "patch"
116+
},
117+
{
118+
"type": "build",
119+
"release": "patch"
116120
}
117121
]
118122
}
@@ -145,6 +149,11 @@
145149
"hidden": false,
146150
"section": "Style"
147151
},
152+
{
153+
"type": "build",
154+
"hidden": false,
155+
"section": "Build"
156+
},
148157
{
149158
"type": "refactor",
150159
"hidden": false,

src/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ const setHighlightCode = ({ highlightCode, language, code }: { highlightCode: Re
212212
const hasModifiedTags = code.match(new RegExp(`(${MODIFIED_START_TAG}|${MODIFIED_CLOSE_TAG})`, 'g'))
213213

214214
if (!hasModifiedTags) {
215-
highlightCode.value = hljs.highlight(language, code).value
215+
highlightCode.value = hljs.highlight(code, { language }).value
216216
return
217217
}
218218

@@ -222,7 +222,7 @@ const setHighlightCode = ({ highlightCode, language, code }: { highlightCode: Re
222222
let originalCode = code // original code with modified tags
223223
const pureCode = code.replace(new RegExp(`(${MODIFIED_START_TAG}|${MODIFIED_CLOSE_TAG})`, 'g'), '') // Without modified tags
224224
let pureElement = document.createElement('div')
225-
pureElement.innerHTML = hljs.highlight(language, pureCode).value // Highlight DOM without modified tags
225+
pureElement.innerHTML = hljs.highlight(pureCode, { language }).value // Highlight DOM without modified tags
226226

227227
// Modified span is created per highlight operator and causes it to continue
228228
let innerModifiedTag = false

0 commit comments

Comments
 (0)