Skip to content

Commit 3277e4e

Browse files
committed
fix(docs): add activeMatch to navigation for proper highlight
Adds activeMatch property to navigation dropdown menus, ensuring the correct nav item is highlighted when browsing sub-pages. Also adds search bar right-alignment CSS for consistency with kimi-cli style.
1 parent 7370f9b commit 3277e4e

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

docs/.vitepress/config.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export default withMermaid(defineConfig({
3636
nav: [
3737
{
3838
text: 'Start',
39+
activeMatch: '/en/getting-started/',
3940
items: [
4041
{ text: 'Docs landing', link: '/en/' },
4142
{ text: 'Quick Start', link: '/en/getting-started/quickstart' },
@@ -44,6 +45,7 @@ export default withMermaid(defineConfig({
4445
},
4546
{
4647
text: 'Learn',
48+
activeMatch: '/en/guides/',
4749
items: [
4850
{ text: 'Learning Path', link: '/en/guides/learning-path' },
4951
{ text: 'Optimization Decision Tree', link: '/en/guides/optimization-decision-tree' },
@@ -54,6 +56,7 @@ export default withMermaid(defineConfig({
5456
},
5557
{
5658
text: 'Reference',
59+
activeMatch: '/en/reference/',
5760
items: [
5861
{ text: 'FAQ', link: '/en/reference/faq' },
5962
{ text: 'Troubleshooting', link: '/en/reference/troubleshooting' },
@@ -62,6 +65,7 @@ export default withMermaid(defineConfig({
6265
},
6366
{
6467
text: 'Contributing',
68+
activeMatch: '/en/contributing/',
6569
items: [
6670
{ text: 'AI Workflow', link: '/en/contributing/ai-workflow' },
6771
{ text: 'Repository', link: 'https://github.com/LessUp/cpp-high-performance-guide' },
@@ -140,6 +144,7 @@ export default withMermaid(defineConfig({
140144
nav: [
141145
{
142146
text: '开始',
147+
activeMatch: '/zh/getting-started/',
143148
items: [
144149
{ text: '文档入口', link: '/zh/' },
145150
{ text: '快速开始', link: '/zh/getting-started/quickstart' },
@@ -148,6 +153,7 @@ export default withMermaid(defineConfig({
148153
},
149154
{
150155
text: '学习',
156+
activeMatch: '/zh/guides/',
151157
items: [
152158
{ text: '学习路径', link: '/zh/guides/learning-path' },
153159
{ text: '优化决策树', link: '/zh/guides/optimization-decision-tree' },
@@ -158,6 +164,7 @@ export default withMermaid(defineConfig({
158164
},
159165
{
160166
text: '参考',
167+
activeMatch: '/zh/reference/',
161168
items: [
162169
{ text: '常见问题', link: '/zh/reference/faq' },
163170
{ text: '故障排查', link: '/zh/reference/troubleshooting' },
@@ -166,6 +173,7 @@ export default withMermaid(defineConfig({
166173
},
167174
{
168175
text: '贡献',
176+
activeMatch: '/zh/contributing/',
169177
items: [
170178
{ text: 'AI 开发流程', link: '/zh/contributing/ai-workflow' },
171179
{ text: '仓库主页', link: 'https://github.com/LessUp/cpp-high-performance-guide' },

docs/.vitepress/theme/style.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,12 @@
215215
color: var(--vp-c-brand-1);
216216
}
217217

218+
/* === Search Bar - Right Aligned === */
219+
.VPNavBarSearch {
220+
display: flex;
221+
justify-content: flex-end;
222+
}
223+
218224
/* === Sidebar Styling === */
219225
.VPSidebar {
220226
padding: var(--spacing-lg) var(--spacing-md) 96px;

0 commit comments

Comments
 (0)