@@ -3,6 +3,7 @@ import { withMermaid } from 'vitepress-plugin-mermaid'
33import llmstxt from 'vitepress-plugin-llms'
44import footnote from 'markdown-it-footnote'
55import mark from 'markdown-it-mark'
6+ import { buildNav , buildSidebar } from './data/site-content.mjs'
67
78const rawBase = process . env . VITEPRESS_BASE
89const base = rawBase
@@ -11,151 +12,6 @@ const base = rawBase
1112 : `/${ rawBase } /`
1213 : '/'
1314
14- // Shared sidebar configuration
15- const sharedSidebar = {
16- '/en/' : [
17- {
18- text : 'Getting Started' ,
19- items : [
20- { text : 'Introduction' , link : '/en/' } ,
21- { text : 'Quick Start' , link : '/en/guide/getting-started' } ,
22- { text : 'Architecture' , link : '/en/guide/architecture' } ,
23- { text : 'Project Structure' , link : '/en/guide/project-structure' } ,
24- ] ,
25- } ,
26- {
27- text : 'Academy' ,
28- items : [
29- { text : 'Algorithm Academy' , link : '/en/academy/' } ,
30- { text : 'Huffman Coding' , link : '/en/academy/huffman' } ,
31- { text : 'State Machine Design' , link : '/en/academy/state-machine' } ,
32- ] ,
33- } ,
34- {
35- text : 'Algorithms' ,
36- items : [
37- { text : 'Overview' , link : '/en/guide/algorithms' } ,
38- { text : 'Huffman Coding' , link : '/en/algorithms/huffman' } ,
39- { text : 'Arithmetic Coding' , link : '/en/algorithms/arithmetic' } ,
40- { text : 'Range Coder' , link : '/en/algorithms/range' } ,
41- { text : 'Run-Length Encoding' , link : '/en/algorithms/rle' } ,
42- ] ,
43- } ,
44- {
45- text : 'API Reference' ,
46- items : [
47- { text : 'Streaming API' , link : '/en/api/streaming' } ,
48- { text : 'Go Library' , link : '/en/api/go' } ,
49- { text : 'Rust Crate' , link : '/en/api/rust' } ,
50- { text : 'C++ Header' , link : '/en/api/cpp' } ,
51- ] ,
52- } ,
53- {
54- text : 'Benchmarks & Testing' ,
55- items : [
56- { text : 'Performance Results' , link : '/en/benchmarks/results' } ,
57- { text : 'How to Run' , link : '/en/benchmarks/how-to-run' } ,
58- { text : 'Cross-Language Testing' , link : '/en/testing/cross-language' } ,
59- ] ,
60- } ,
61- {
62- text : 'Reference' ,
63- items : [
64- { text : 'Architecture Design' , link : '/en/architecture/' } ,
65- { text : 'Bibliography' , link : '/en/reference/bibliography' } ,
66- { text : 'OpenSpec Specs' , link : 'https://github.com/LessUp/compress-kit/tree/master/openspec/specs' } ,
67- { text : 'Contributing' , link : '/en/guide/contributing' } ,
68- { text : 'Changelog' , link : '/en/release-notes/changelog' } ,
69- ] ,
70- } ,
71- ] ,
72- '/zh/' : [
73- {
74- text : '开始使用' ,
75- items : [
76- { text : '项目介绍' , link : '/zh/' } ,
77- { text : '快速开始' , link : '/zh/guide/getting-started' } ,
78- { text : '架构设计' , link : '/zh/guide/architecture' } ,
79- { text : '项目结构' , link : '/zh/guide/project-structure' } ,
80- ] ,
81- } ,
82- {
83- text : '学院' ,
84- items : [
85- { text : '算法学院' , link : '/zh/academy/' } ,
86- { text : '霍夫曼编码深度解析' , link : '/zh/academy/huffman' } ,
87- { text : '状态机设计哲学' , link : '/zh/academy/state-machine' } ,
88- ] ,
89- } ,
90- {
91- text : '算法详解' ,
92- items : [
93- { text : '算法综述' , link : '/zh/guide/algorithms' } ,
94- { text : '霍夫曼编码' , link : '/zh/algorithms/huffman' } ,
95- { text : '算术编码' , link : '/zh/algorithms/arithmetic' } ,
96- { text : '区间编码' , link : '/zh/algorithms/range' } ,
97- { text : '行程编码' , link : '/zh/algorithms/rle' } ,
98- ] ,
99- } ,
100- {
101- text : 'API 参考' ,
102- items : [
103- { text : 'Streaming API' , link : '/zh/api/streaming' } ,
104- { text : 'Go 库' , link : '/zh/api/go' } ,
105- { text : 'Rust 包' , link : '/zh/api/rust' } ,
106- { text : 'C++ 头文件' , link : '/zh/api/cpp' } ,
107- ] ,
108- } ,
109- {
110- text : '基准测试' ,
111- items : [
112- { text : '性能结果' , link : '/zh/benchmarks/results' } ,
113- { text : '如何运行' , link : '/zh/benchmarks/how-to-run' } ,
114- { text : '跨语言测试' , link : '/zh/testing/cross-language' } ,
115- ] ,
116- } ,
117- {
118- text : '参考' ,
119- items : [
120- { text : '系统架构设计' , link : '/zh/architecture/' } ,
121- { text : '参考文献' , link : '/zh/reference/bibliography' } ,
122- { text : 'OpenSpec 规范' , link : 'https://github.com/LessUp/compress-kit/tree/master/openspec/specs' } ,
123- { text : '参与贡献' , link : '/zh/guide/contributing' } ,
124- { text : '更新日志' , link : '/zh/release-notes/changelog' } ,
125- ] ,
126- } ,
127- ] ,
128- }
129-
130- // Shared nav configuration
131- const sharedNav = ( lang : string ) => [
132- {
133- text : lang === 'zh' ? '首页' : 'Home' ,
134- link : lang === 'zh' ? '/zh/' : '/en/' ,
135- activeMatch : lang === 'zh' ? '^/zh/$' : '^/en/$'
136- } ,
137- {
138- text : lang === 'zh' ? '开始' : 'Get Started' ,
139- link : lang === 'zh' ? '/zh/guide/getting-started' : '/en/guide/getting-started' ,
140- activeMatch : lang === 'zh' ? '/zh/guide/' : '/en/guide/'
141- } ,
142- {
143- text : lang === 'zh' ? '算法' : 'Algorithms' ,
144- link : lang === 'zh' ? '/zh/guide/algorithms' : '/en/guide/algorithms' ,
145- activeMatch : lang === 'zh' ? '/zh/algorithms/' : '/en/algorithms/'
146- } ,
147- {
148- text : 'API' ,
149- link : lang === 'zh' ? '/zh/api/go' : '/en/api/go' ,
150- activeMatch : lang === 'zh' ? '/zh/api/' : '/en/api/'
151- } ,
152- {
153- text : lang === 'zh' ? '基准' : 'Benchmarks' ,
154- link : lang === 'zh' ? '/zh/benchmarks/results' : '/en/benchmarks/results' ,
155- activeMatch : lang === 'zh' ? '/zh/benchmarks/' : '/en/benchmarks/'
156- } ,
157- ]
158-
15915export default withMermaid ( defineConfig ( {
16016 base,
16117 title : 'CompressKit' ,
@@ -175,8 +31,8 @@ export default withMermaid(defineConfig({
17531 lang : 'en-US' ,
17632 link : '/en/' ,
17733 themeConfig : {
178- nav : sharedNav ( 'en' ) ,
179- sidebar : sharedSidebar [ '/en/' ] ,
34+ nav : buildNav ( 'en' ) ,
35+ sidebar : buildSidebar ( 'en' ) ,
18036 editLink : {
18137 pattern : 'https://github.com/LessUp/compress-kit/edit/master/docs/:path' ,
18238 text : 'Edit this page on GitHub' ,
@@ -223,8 +79,8 @@ export default withMermaid(defineConfig({
22379 lang : 'zh-CN' ,
22480 link : '/zh/' ,
22581 themeConfig : {
226- nav : sharedNav ( 'zh' ) ,
227- sidebar : sharedSidebar [ '/zh/' ] ,
82+ nav : buildNav ( 'zh' ) ,
83+ sidebar : buildSidebar ( 'zh' ) ,
22884 editLink : {
22985 pattern : 'https://github.com/LessUp/compress-kit/edit/master/docs/:path' ,
23086 text : '在 GitHub 上编辑此页' ,
0 commit comments