chore: version 2.8.2 (#159)

* fix: 修复普通文本代码渲染和深色模式下的问题[#139][#154]

* chore: version 2.8.2
This commit is contained in:
Redon
2023-02-28 10:00:53 +08:00
committed by GitHub
parent 21fb4f817c
commit 94e23bb916
8 changed files with 235 additions and 14 deletions

View File

@@ -24,11 +24,17 @@ renderer.html = (html) => {
renderer.code = (code, language) => {
const validLang = !!(language && hljs.getLanguage(language))
const highlighted = validLang ? hljs.highlight(language, code).value : code
return `<pre><code class="hljs ${language}">${highlighted}</code></pre>`
if (validLang)
return `<pre><code class="hljs ${language}">${hljs.highlight(language, code).value}</code></pre>`
return `<pre style="background: none">${hljs.highlightAuto(code).value}</pre>`
}
marked.setOptions({ renderer })
marked.setOptions({
renderer,
highlight(code) {
return hljs.highlightAuto(code).value
},
})
const wrapClass = computed(() => {
return [

View File

@@ -2,7 +2,7 @@
background-color: transparent;
font-size: 14px;
p{
p {
white-space: pre-wrap;
}
@@ -23,13 +23,16 @@
pre {
background-color: #fff;
}
}
.dark{
.markdown-body{
.highlight pre,
pre {
background-color: #18181c;
}
code.hljs{
padding: 0;
}
}
html.dark {
.highlight pre,
pre {
background-color: #282c34;
}
}