mirror of
https://github.com/Chanzhaoyu/chatgpt-web.git
synced 2025-07-24 23:13:47 +00:00
chore: version 2.8.2 (#159)
* fix: 修复普通文本代码渲染和深色模式下的问题[#139][#154] * chore: version 2.8.2
This commit is contained in:
@@ -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 [
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user