feat(ui): 会话正文里的围栏代码块也上色

md 渲染只做了 marked → HTML + 复制按钮,聊天里贴的 ```js 一直是无色纯文本;
代码预览和 Git diff 都上色了,唯独对话主体没有。

历史渲染在 appendMessagesDom 收口处、流式在 stream.js 两处(收尾整块重排与
分页追加)各补一次 pvHighlightMdCode;token 配色的选择器前缀加上 .md(聊天气泡
的 markdown 容器),与预览共用同一套 GitHub 配色。
This commit is contained in:
2026-11-13 17:11:11 +08:00
parent 87b8d5197b
commit 0529991ba1
3 changed files with 15 additions and 12 deletions
+12 -12
View File
@@ -1684,18 +1684,18 @@ body.pv-max .pv-code { max-width: none; padding-left: 16px; padding-right: 16px;
@media (max-width: 959px) {
.pv-cl::before { width: 28px; margin-right: 6px; padding-right: 4px; }
}
/* Prism token 配色(GitHub 亮色系):代码预览、md 围栏代码块、Git 面板 diff 共用 */
:is(.pv-code, .pv-doc, .vcs-line) :is(.token.comment, .token.prolog, .token.doctype, .token.cdata) { color: #6a737d; font-style: italic; }
:is(.pv-code, .pv-doc, .vcs-line) .token.punctuation { color: #24292e; }
:is(.pv-code, .pv-doc, .vcs-line) .token.namespace { opacity: .7; }
:is(.pv-code, .pv-doc, .vcs-line) :is(.token.property, .token.tag, .token.boolean, .token.number, .token.constant, .token.symbol, .token.deleted) { color: #005cc5; }
:is(.pv-code, .pv-doc, .vcs-line) :is(.token.selector, .token.attr-name, .token.string, .token.char, .token.builtin, .token.inserted) { color: #032f62; }
:is(.pv-code, .pv-doc, .vcs-line) :is(.token.operator, .token.entity, .token.url) { color: #d73a49; }
:is(.pv-code, .pv-doc, .vcs-line) :is(.token.atrule, .token.attr-value, .token.keyword) { color: #d73a49; }
:is(.pv-code, .pv-doc, .vcs-line) :is(.token.function, .token.class-name) { color: #6f42c1; }
:is(.pv-code, .pv-doc, .vcs-line) :is(.token.regex, .token.important, .token.variable) { color: #e36209; }
:is(.pv-code, .pv-doc, .vcs-line) .token.bold { font-weight: 600; }
:is(.pv-code, .pv-doc, .vcs-line) .token.italic { font-style: italic; }
/* Prism token 配色(GitHub 亮色系):代码预览、md 围栏代码块(预览与对话正文)、Git 面板 diff 共用 */
:is(.pv-code, .pv-doc, .vcs-line, .md) :is(.token.comment, .token.prolog, .token.doctype, .token.cdata) { color: #6a737d; font-style: italic; }
:is(.pv-code, .pv-doc, .vcs-line, .md) .token.punctuation { color: #24292e; }
:is(.pv-code, .pv-doc, .vcs-line, .md) .token.namespace { opacity: .7; }
:is(.pv-code, .pv-doc, .vcs-line, .md) :is(.token.property, .token.tag, .token.boolean, .token.number, .token.constant, .token.symbol, .token.deleted) { color: #005cc5; }
:is(.pv-code, .pv-doc, .vcs-line, .md) :is(.token.selector, .token.attr-name, .token.string, .token.char, .token.builtin, .token.inserted) { color: #032f62; }
:is(.pv-code, .pv-doc, .vcs-line, .md) :is(.token.operator, .token.entity, .token.url) { color: #d73a49; }
:is(.pv-code, .pv-doc, .vcs-line, .md) :is(.token.atrule, .token.attr-value, .token.keyword) { color: #d73a49; }
:is(.pv-code, .pv-doc, .vcs-line, .md) :is(.token.function, .token.class-name) { color: #6f42c1; }
:is(.pv-code, .pv-doc, .vcs-line, .md) :is(.token.regex, .token.important, .token.variable) { color: #e36209; }
:is(.pv-code, .pv-doc, .vcs-line, .md) .token.bold { font-weight: 600; }
:is(.pv-code, .pv-doc, .vcs-line, .md) .token.italic { font-style: italic; }
.pv-trunc { max-width: 880px; margin: 12px auto 0; padding: 0 20px; font-size: 12px; color: var(--gray-light); }
.pv-loading.inline { position: static; background: transparent; padding: 56px 0; }
.pv-none { margin: auto; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 44px 24px; text-align: center; }