fix: highlight.js 控制台兼容性警告

This commit is contained in:
ChenZhaoYu 2023-03-17 09:49:43 +08:00
parent 95724845cf
commit a8e9a24ca7
1 changed files with 1 additions and 1 deletions

View File

@ -25,7 +25,7 @@ const mdi = new MarkdownIt({
const validLang = !!(language && hljs.getLanguage(language)) const validLang = !!(language && hljs.getLanguage(language))
if (validLang) { if (validLang) {
const lang = language ?? '' const lang = language ?? ''
return highlightBlock(hljs.highlight(lang, code, true).value, lang) return highlightBlock(hljs.highlight(code, { language: lang }).value, lang)
} }
return highlightBlock(hljs.highlightAuto(code).value, '') return highlightBlock(hljs.highlightAuto(code).value, '')
}, },