@@ -5,6 +5,166 @@ import { defineConfig } from 'vitepress'
55// - 自定义域名: DOCS_BASE=/
66const base = process . env . DOCS_BASE || '/stock-sdk/'
77
8+ // 中文侧边栏配置
9+ const zhSidebar = {
10+ '/guide/' : [
11+ {
12+ text : '开始' ,
13+ items : [
14+ { text : '介绍' , link : '/guide/introduction' } ,
15+ { text : '安装' , link : '/guide/installation' } ,
16+ { text : '快速开始' , link : '/guide/getting-started' } ,
17+ ] ,
18+ } ,
19+ {
20+ text : '环境与部署' ,
21+ items : [
22+ { text : '浏览器使用' , link : '/guide/browser' } ,
23+ ] ,
24+ } ,
25+ {
26+ text : '进阶' ,
27+ items : [
28+ { text : '技术指标' , link : '/guide/indicators' } ,
29+ { text : '批量查询' , link : '/guide/batch' } ,
30+ ] ,
31+ } ,
32+ {
33+ text : '更多' ,
34+ items : [ { text : '更新日志' , link : '/changelog' } ] ,
35+ } ,
36+ ] ,
37+ '/api/' : [
38+ {
39+ text : 'API 总览' ,
40+ items : [ { text : '概览' , link : '/api/' } ] ,
41+ } ,
42+ {
43+ text : '实时行情' ,
44+ items : [
45+ { text : 'A 股行情' , link : '/api/quotes' } ,
46+ { text : '港股行情' , link : '/api/hk-quotes' } ,
47+ { text : '美股行情' , link : '/api/us-quotes' } ,
48+ { text : '基金行情' , link : '/api/fund-quotes' } ,
49+ ] ,
50+ } ,
51+ {
52+ text : 'K 线数据' ,
53+ items : [
54+ { text : '历史 K 线' , link : '/api/kline' } ,
55+ { text : '分钟 K 线' , link : '/api/minute-kline' } ,
56+ { text : '分时走势' , link : '/api/timeline' } ,
57+ ] ,
58+ } ,
59+ {
60+ text : '技术指标' ,
61+ items : [
62+ { text : '指标概览' , link : '/api/indicators' } ,
63+ { text : 'MA 均线' , link : '/api/indicator-ma' } ,
64+ { text : 'MACD' , link : '/api/indicator-macd' } ,
65+ { text : 'BOLL 布林带' , link : '/api/indicator-boll' } ,
66+ { text : 'KDJ' , link : '/api/indicator-kdj' } ,
67+ { text : 'RSI / WR' , link : '/api/indicator-rsi-wr' } ,
68+ { text : 'BIAS 乖离率' , link : '/api/indicator-bias' } ,
69+ { text : 'CCI 商品通道指数' , link : '/api/indicator-cci' } ,
70+ { text : 'ATR 平均真实波幅' , link : '/api/indicator-atr' } ,
71+ ] ,
72+ } ,
73+ {
74+ text : '批量与扩展' ,
75+ items : [
76+ { text : '代码列表' , link : '/api/code-lists' } ,
77+ { text : '批量查询' , link : '/api/batch' } ,
78+ { text : '资金流向' , link : '/api/fund-flow' } ,
79+ ] ,
80+ } ,
81+ {
82+ text : '更多' ,
83+ items : [ { text : '更新日志' , link : '/changelog' } ] ,
84+ } ,
85+ ] ,
86+ }
87+
88+ // 英文侧边栏配置
89+ const enSidebar = {
90+ '/en/guide/' : [
91+ {
92+ text : 'Getting Started' ,
93+ items : [
94+ { text : 'Introduction' , link : '/en/guide/introduction' } ,
95+ { text : 'Installation' , link : '/en/guide/installation' } ,
96+ { text : 'Quick Start' , link : '/en/guide/getting-started' } ,
97+ ] ,
98+ } ,
99+ {
100+ text : 'Environment' ,
101+ items : [
102+ { text : 'Browser Usage' , link : '/en/guide/browser' } ,
103+ ] ,
104+ } ,
105+ {
106+ text : 'Advanced' ,
107+ items : [
108+ { text : 'Technical Indicators' , link : '/en/guide/indicators' } ,
109+ { text : 'Batch Query' , link : '/en/guide/batch' } ,
110+ ] ,
111+ } ,
112+ {
113+ text : 'More' ,
114+ items : [ { text : 'Changelog' , link : '/en/changelog' } ] ,
115+ } ,
116+ ] ,
117+ '/en/api/' : [
118+ {
119+ text : 'API Overview' ,
120+ items : [ { text : 'Overview' , link : '/en/api/' } ] ,
121+ } ,
122+ {
123+ text : 'Real-time Quotes' ,
124+ items : [
125+ { text : 'A-Share Quotes' , link : '/en/api/quotes' } ,
126+ { text : 'HK Stock Quotes' , link : '/en/api/hk-quotes' } ,
127+ { text : 'US Stock Quotes' , link : '/en/api/us-quotes' } ,
128+ { text : 'Fund Quotes' , link : '/en/api/fund-quotes' } ,
129+ ] ,
130+ } ,
131+ {
132+ text : 'K-Line Data' ,
133+ items : [
134+ { text : 'History K-Line' , link : '/en/api/kline' } ,
135+ { text : 'Minute K-Line' , link : '/en/api/minute-kline' } ,
136+ { text : 'Timeline' , link : '/en/api/timeline' } ,
137+ ] ,
138+ } ,
139+ {
140+ text : 'Technical Indicators' ,
141+ items : [
142+ { text : 'Indicators Overview' , link : '/en/api/indicators' } ,
143+ { text : 'MA' , link : '/en/api/indicator-ma' } ,
144+ { text : 'MACD' , link : '/en/api/indicator-macd' } ,
145+ { text : 'BOLL' , link : '/en/api/indicator-boll' } ,
146+ { text : 'KDJ' , link : '/en/api/indicator-kdj' } ,
147+ { text : 'RSI / WR' , link : '/en/api/indicator-rsi-wr' } ,
148+ { text : 'BIAS' , link : '/en/api/indicator-bias' } ,
149+ { text : 'CCI' , link : '/en/api/indicator-cci' } ,
150+ { text : 'ATR' , link : '/en/api/indicator-atr' } ,
151+ ] ,
152+ } ,
153+ {
154+ text : 'Batch & Extended' ,
155+ items : [
156+ { text : 'Code Lists' , link : '/en/api/code-lists' } ,
157+ { text : 'Batch Query' , link : '/en/api/batch' } ,
158+ { text : 'Fund Flow' , link : '/en/api/fund-flow' } ,
159+ ] ,
160+ } ,
161+ {
162+ text : 'More' ,
163+ items : [ { text : 'Changelog' , link : '/en/changelog' } ] ,
164+ } ,
165+ ] ,
166+ }
167+
8168export default defineConfig ( {
9169 title : 'Stock SDK' ,
10170 description : '为前端和 Node.js 设计的股票行情 SDK' ,
@@ -16,94 +176,89 @@ export default defineConfig({
16176 [ 'meta' , { name : 'theme-color' , content : '#3eaf7c' } ] ,
17177 ] ,
18178
19- themeConfig : {
20- logo : '/logo.svg' ,
21-
22- nav : [
23- { text : '指南' , link : '/guide/getting-started' } ,
24- { text : 'API' , link : '/api/' } ,
25- { text : 'Playground' , link : '/playground/' } ,
26- { text : '更新日志' , link : '/changelog' } ,
27- ] ,
28-
29- sidebar : {
30- '/guide/' : [
31- {
32- text : '开始' ,
33- items : [
34- { text : '介绍' , link : '/guide/introduction' } ,
35- { text : '安装' , link : '/guide/installation' } ,
36- { text : '快速开始' , link : '/guide/getting-started' } ,
37- ] ,
179+ // 国际化配置
180+ locales : {
181+ root : {
182+ label : '简体中文' ,
183+ lang : 'zh-CN' ,
184+ themeConfig : {
185+ nav : [
186+ { text : '指南' , link : '/guide/getting-started' } ,
187+ { text : 'API' , link : '/api/' } ,
188+ { text : 'Playground' , link : '/playground/' } ,
189+ { text : '更新日志' , link : '/changelog' } ,
190+ ] ,
191+ sidebar : zhSidebar ,
192+ outline : {
193+ level : [ 2 , 3 ] ,
194+ label : '页面导航' ,
38195 } ,
39- {
40- text : '环境与部署' ,
41- items : [
42- { text : '浏览器使用' , link : '/guide/browser' } ,
43- ] ,
196+ docFooter : {
197+ prev : '上一页' ,
198+ next : '下一页' ,
44199 } ,
45- {
46- text : '进阶' ,
47- items : [
48- { text : '技术指标' , link : '/guide/indicators' } ,
49- { text : '批量查询' , link : '/guide/batch' } ,
50- ] ,
200+ lastUpdated : {
201+ text : '最后更新于' ,
51202 } ,
52- {
53- text : '更多 ' ,
54- items : [ { text : '更新日志' , link : '/changelog' } ] ,
203+ editLink : {
204+ pattern : 'https://github.com/chengzuopeng/stock-sdk/edit/main/website/:path ' ,
205+ text : '在 GitHub 上编辑此页' ,
55206 } ,
56- ] ,
57- '/api/' : [
58- {
59- text : 'API 总览' ,
60- items : [ { text : '概览' , link : '/api/' } ] ,
61- } ,
62- {
63- text : '实时行情' ,
64- items : [
65- { text : 'A 股行情' , link : '/api/quotes' } ,
66- { text : '港股行情' , link : '/api/hk-quotes' } ,
67- { text : '美股行情' , link : '/api/us-quotes' } ,
68- { text : '基金行情' , link : '/api/fund-quotes' } ,
69- ] ,
207+ search : {
208+ provider : 'local' ,
209+ options : {
210+ translations : {
211+ button : {
212+ buttonText : '搜索文档' ,
213+ buttonAriaLabel : '搜索文档' ,
214+ } ,
215+ modal : {
216+ noResultsText : '无法找到相关结果' ,
217+ resetButtonTitle : '清除查询条件' ,
218+ footer : {
219+ selectText : '选择' ,
220+ navigateText : '切换' ,
221+ closeText : '关闭' ,
222+ } ,
223+ } ,
224+ } ,
225+ } ,
70226 } ,
71- {
72- text : 'K 线数据' ,
73- items : [
74- { text : '历史 K 线' , link : '/api/kline' } ,
75- { text : '分钟 K 线' , link : '/api/minute-kline' } ,
76- { text : '分时走势' , link : '/api/timeline' } ,
77- ] ,
227+ } ,
228+ } ,
229+ en : {
230+ label : 'English' ,
231+ lang : 'en-US' ,
232+ link : '/en/' ,
233+ themeConfig : {
234+ nav : [
235+ { text : 'Guide' , link : '/en/guide/getting-started' } ,
236+ { text : 'API' , link : '/en/api/' } ,
237+ { text : 'Playground' , link : '/en/playground/' } ,
238+ { text : 'Changelog' , link : '/en/changelog' } ,
239+ ] ,
240+ sidebar : enSidebar ,
241+ outline : {
242+ level : [ 2 , 3 ] ,
243+ label : 'On this page' ,
78244 } ,
79- {
80- text : '技术指标' ,
81- items : [
82- { text : '指标概览' , link : '/api/indicators' } ,
83- { text : 'MA 均线' , link : '/api/indicator-ma' } ,
84- { text : 'MACD' , link : '/api/indicator-macd' } ,
85- { text : 'BOLL 布林带' , link : '/api/indicator-boll' } ,
86- { text : 'KDJ' , link : '/api/indicator-kdj' } ,
87- { text : 'RSI / WR' , link : '/api/indicator-rsi-wr' } ,
88- { text : 'BIAS 乖离率' , link : '/api/indicator-bias' } ,
89- { text : 'CCI 商品通道指数' , link : '/api/indicator-cci' } ,
90- { text : 'ATR 平均真实波幅' , link : '/api/indicator-atr' } ,
91- ] ,
245+ docFooter : {
246+ prev : 'Previous' ,
247+ next : 'Next' ,
92248 } ,
93- {
94- text : '批量与扩展' ,
95- items : [
96- { text : '代码列表' , link : '/api/code-lists' } ,
97- { text : '批量查询' , link : '/api/batch' } ,
98- { text : '资金流向' , link : '/api/fund-flow' } ,
99- ] ,
249+ lastUpdated : {
250+ text : 'Last updated' ,
100251 } ,
101- {
102- text : '更多 ' ,
103- items : [ { text : '更新日志' , link : '/changelog' } ] ,
252+ editLink : {
253+ pattern : 'https://github.com/chengzuopeng/stock-sdk/edit/main/website/:path ' ,
254+ text : 'Edit this page on GitHub' ,
104255 } ,
105- ] ,
256+ } ,
106257 } ,
258+ } ,
259+
260+ themeConfig : {
261+ logo : '/logo.svg' ,
107262
108263 socialLinks : [
109264 { icon : 'github' , link : 'https://github.com/chengzuopeng/stock-sdk' } ,
@@ -116,48 +271,9 @@ export default defineConfig({
116271
117272 search : {
118273 provider : 'local' ,
119- options : {
120- translations : {
121- button : {
122- buttonText : '搜索文档' ,
123- buttonAriaLabel : '搜索文档' ,
124- } ,
125- modal : {
126- noResultsText : '无法找到相关结果' ,
127- resetButtonTitle : '清除查询条件' ,
128- footer : {
129- selectText : '选择' ,
130- navigateText : '切换' ,
131- closeText : '关闭' ,
132- } ,
133- } ,
134- } ,
135- } ,
136- } ,
137-
138- outline : {
139- level : [ 2 , 3 ] ,
140- label : '页面导航' ,
141- } ,
142-
143- docFooter : {
144- prev : '上一页' ,
145- next : '下一页' ,
146- } ,
147-
148- lastUpdated : {
149- text : '最后更新于' ,
150- } ,
151-
152- editLink : {
153- pattern : 'https://github.com/chengzuopeng/stock-sdk/edit/main/website/:path' ,
154- text : '在 GitHub 上编辑此页' ,
155274 } ,
156275 } ,
157276
158- // 中文优化
159- lang : 'zh-CN' ,
160-
161277 // Markdown 配置
162278 markdown : {
163279 lineNumbers : true ,
@@ -169,7 +285,6 @@ export default defineConfig({
169285
170286 // Vite 配置
171287 vite : {
172- // 允许在开发时访问外部资源
173288 server : {
174289 fs : {
175290 allow : [ '..' ] ,
0 commit comments