fixed hilinejs plugin

This commit is contained in:
GeekMaster
2025-05-29 11:39:55 +08:00
parent 97e489901a
commit 598f6c48fb

View File

@@ -326,7 +326,7 @@ const md = MarkdownIt({
highlight: function (str, lang) {
if (lang && hl.getLanguage(lang)) {
// 处理代码高亮
const preCode = hl.highlight(lang, str, true).value
const preCode = hl.highlight(str, { language: lang }).value
// 将代码包裹在 pre 中
return `<pre class="code-container"><code class="language-${lang} hljs">${preCode}</code></pre>`
}