Skip to content

Commit dc6bf56

Browse files
wutongciclaude
andcommitted
修复代码语法高亮配置 - 添加Go语言支持
问题根因: - 之前的配置只设置了 theme,但没有设置 langs 列表 - 导致 Nuxt Content 配置合并时覆盖了 Docus 的 highlight 配置 - Go 语言不在支持的语言列表中,Shiki 无法识别,回退到纯文本模式 修复方案: 在 nuxt.config.ts 中同时配置 langs 和 theme: - langs: 包含 go, bash, js, ts, python, java 等语言 - theme: material-theme-lighter (亮色) / material-theme-palenight (暗黑) 验证: - ✅ Go 代码块显示正确的语法高亮 - ✅ 关键字、字符串、注释有不同颜色 - ✅ 亮色和暗黑模式都正常工作 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 260958f commit dc6bf56

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

docs/nuxt.config.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,31 @@ export default defineNuxtConfig({
2020
// 为 nuxt-llms 提供一个域名, 避免生成阶段的警告(不影响功能)
2121
llms: {
2222
domain: 'https://agentsdk.local'
23+
},
24+
25+
// Nuxt Content 配置 - 启用代码高亮
26+
content: {
27+
build: {
28+
markdown: {
29+
highlight: {
30+
// 支持的编程语言列表(必须显式声明以覆盖父主题配置)
31+
langs: [
32+
'bash', 'sh', 'shell', 'zsh',
33+
'diff', 'json',
34+
'javascript', 'js', 'typescript', 'ts',
35+
'html', 'css', 'vue',
36+
'markdown', 'md', 'yaml', 'yml',
37+
'go', // Go 语言支持(关键)
38+
'python', 'py',
39+
'java',
40+
],
41+
// Shiki 主题配置
42+
theme: {
43+
default: 'material-theme-lighter',
44+
dark: 'material-theme-palenight'
45+
}
46+
}
47+
}
48+
}
2349
}
2450
})

0 commit comments

Comments
 (0)