Skip to content

Commit c28693d

Browse files
committed
feat(docs): improve documentation
1 parent 7bef4ca commit c28693d

File tree

12 files changed

+1825
-183
lines changed

12 files changed

+1825
-183
lines changed

docs/.vuepress/components/Terminal.vue

Lines changed: 422 additions & 0 deletions
Large diffs are not rendered by default.

docs/.vuepress/config.ts

Lines changed: 216 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,73 @@
11
import { viteBundler } from '@vuepress/bundler-vite';
2-
// import registerComponentsPlugin from '@vuepress/plugin-register-components';
32
import { registerComponentsPlugin } from '@vuepress/plugin-register-components';
43
import { path } from '@vuepress/utils';
4+
import container from 'markdown-it-container';
55
import { defineUserConfig } from 'vuepress';
66
import { plumeTheme } from 'vuepress-theme-plume';
77

88
export default defineUserConfig({
99
base: '/',
1010
lang: 'en-US',
11-
title: 'Static Pages',
11+
title: 'StaticPages',
1212
description: 'StaticPages is a simple server implementation to host your static pages with support for preview URLs.',
1313

1414
head: [
15-
['meta', { name: "description", content: "StaticPages is a simple server implementation to host your static pages with support for preview URLs." }],
15+
[
16+
'meta',
17+
{
18+
name: 'description',
19+
content:
20+
'StaticPages is a simple server implementation to host your static pages with support for preview URLs.',
21+
},
22+
],
1623
['link', { rel: 'icon', type: 'image/png', href: '/images/specht.png' }],
1724
],
1825

1926
bundler: viteBundler(),
2027
shouldPrefetch: false,
2128

29+
extendsMarkdown: (md) => {
30+
md.use(container, 'terminal', {
31+
validate: (params: string) => /^terminal(?:\s+.*)?$/.test(params.trim()),
32+
render: (tokens: any[], idx: number) => {
33+
const token = tokens[idx];
34+
35+
if (token.nesting === 1) {
36+
const info = token.info.trim();
37+
const rest = info.replace(/^terminal\s*/, '');
38+
39+
const attrs: Record<string, string> = {};
40+
const attrRegex = /(\w+)=((?:"[^"]*")|(?:'[^']*')|(?:[^\s]+))/g;
41+
let consumed = '';
42+
let match: RegExpExecArray | null;
43+
44+
while ((match = attrRegex.exec(rest)) !== null) {
45+
const key = match[1];
46+
let value = match[2];
47+
48+
if (
49+
(value.startsWith('"') && value.endsWith('"')) ||
50+
(value.startsWith("'") && value.endsWith("'"))
51+
) {
52+
value = value.slice(1, -1);
53+
}
54+
55+
attrs[key] = value;
56+
consumed += `${match[0]} `;
57+
}
58+
59+
const positional = rest.replace(consumed, '').trim();
60+
const titleRaw = attrs.title ?? positional ?? '';
61+
const title = titleRaw ? md.utils.escapeHtml(titleRaw) : '';
62+
63+
return `\n<Terminal${title ? ` title="${title}"` : ''}>\n`;
64+
}
65+
66+
return '\n</Terminal>\n';
67+
},
68+
});
69+
},
70+
2271
plugins: [
2372
registerComponentsPlugin({
2473
componentsDir: path.resolve(__dirname, './components'),
@@ -30,58 +79,184 @@ export default defineUserConfig({
3079
docsDir: 'docs',
3180
docsBranch: 'main',
3281

33-
editLink: false,
82+
editLink: true,
3483
lastUpdated: false,
3584
contributors: false,
3685

3786
cache: 'filesystem',
3887
search: { provider: 'local' },
3988

89+
sidebar: {
90+
'/guide/': [
91+
{
92+
text: 'Getting Started',
93+
icon: 'mdi:rocket-launch',
94+
prefix: '/guide/',
95+
items: [
96+
{ text: 'Overview', link: 'overview', icon: 'mdi:eye' },
97+
{ text: 'Quickstart', link: 'quickstart', icon: 'mdi:flash', badge: '5 min' },
98+
],
99+
},
100+
{
101+
text: 'How-to Guides',
102+
icon: 'mdi:compass',
103+
prefix: '/how-to/',
104+
items: [
105+
{ text: 'Set up Cloudflare CDN', link: 'setup-cloudflare-cdn', icon: 'mdi:cloud-outline' },
106+
{ text: 'Fix Backblaze Redirect Issue', link: 'fix-backblaze-redirect-issue', icon: 'mdi:wrench' },
107+
],
108+
},
109+
{
110+
text: 'Explanations',
111+
icon: 'mdi:lightbulb-on-outline',
112+
prefix: '/explanation/',
113+
items: [
114+
{ text: 'Backblaze B2 URL Structure', link: 'backblaze-b2-url-structure', icon: 'mdi:link-variant' },
115+
{ text: 'Proxy Origin Bypass', link: 'proxy-origin-bypass', icon: 'mdi:shield-lock-outline' },
116+
],
117+
},
118+
{
119+
text: 'Reference',
120+
icon: 'mdi:book-open-page-variant',
121+
prefix: '/reference/',
122+
collapsed: false,
123+
items: [{ text: 'Backblaze B2 Config', link: 'backblaze-b2-config', icon: 'mdi:file-cog' }],
124+
},
125+
],
126+
127+
'/how-to/': [
128+
{
129+
text: 'Getting Started',
130+
icon: 'mdi:rocket-launch',
131+
prefix: '/guide/',
132+
items: [
133+
{ text: 'Overview', link: 'overview', icon: 'mdi:eye' },
134+
{ text: 'Quickstart', link: 'quickstart', icon: 'mdi:flash', badge: '5 min' },
135+
],
136+
},
137+
{
138+
text: 'How-to Guides',
139+
icon: 'mdi:compass',
140+
prefix: '/how-to/',
141+
items: [
142+
{ text: 'Set up Cloudflare CDN', link: 'setup-cloudflare-cdn', icon: 'mdi:cloud-outline' },
143+
{ text: 'Fix Backblaze Redirect Issue', link: 'fix-backblaze-redirect-issue', icon: 'mdi:wrench' },
144+
],
145+
},
146+
{
147+
text: 'Explanations',
148+
icon: 'mdi:lightbulb-on-outline',
149+
prefix: '/explanation/',
150+
items: [
151+
{ text: 'Backblaze B2 URL Structure', link: 'backblaze-b2-url-structure', icon: 'mdi:link-variant' },
152+
{ text: 'Proxy Origin Bypass', link: 'proxy-origin-bypass', icon: 'mdi:shield-lock-outline' },
153+
],
154+
},
155+
{
156+
text: 'Reference',
157+
icon: 'mdi:book-open-page-variant',
158+
prefix: '/reference/',
159+
collapsed: false,
160+
items: [{ text: 'Backblaze B2 Config', link: 'backblaze-b2-config', icon: 'mdi:file-cog' }],
161+
},
162+
],
163+
164+
'/explanation/': [
165+
{
166+
text: 'Getting Started',
167+
icon: 'mdi:rocket-launch',
168+
prefix: '/guide/',
169+
items: [
170+
{ text: 'Overview', link: 'overview', icon: 'mdi:eye' },
171+
{ text: 'Quickstart', link: 'quickstart', icon: 'mdi:flash', badge: '5 min' },
172+
],
173+
},
174+
{
175+
text: 'How-to Guides',
176+
icon: 'mdi:compass',
177+
prefix: '/how-to/',
178+
items: [
179+
{ text: 'Set up Cloudflare CDN', link: 'setup-cloudflare-cdn', icon: 'mdi:cloud-outline' },
180+
{ text: 'Fix Backblaze Redirect Issue', link: 'fix-backblaze-redirect-issue', icon: 'mdi:wrench' },
181+
],
182+
},
183+
{
184+
text: 'Explanations',
185+
icon: 'mdi:lightbulb-on-outline',
186+
prefix: '/explanation/',
187+
items: [
188+
{ text: 'Backblaze B2 URL Structure', link: 'backblaze-b2-url-structure', icon: 'mdi:link-variant' },
189+
{ text: 'Proxy Origin Bypass', link: 'proxy-origin-bypass', icon: 'mdi:shield-lock-outline' },
190+
],
191+
},
192+
{
193+
text: 'Reference',
194+
icon: 'mdi:book-open-page-variant',
195+
prefix: '/reference/',
196+
collapsed: false,
197+
items: [{ text: 'Backblaze B2 Config', link: 'backblaze-b2-config', icon: 'mdi:file-cog' }],
198+
},
199+
],
200+
201+
'/reference/': [
202+
{
203+
text: 'Getting Started',
204+
icon: 'mdi:rocket-launch',
205+
prefix: '/guide/',
206+
items: [
207+
{ text: 'Overview', link: 'overview', icon: 'mdi:eye' },
208+
{ text: 'Quickstart', link: 'quickstart', icon: 'mdi:flash', badge: '5 min' },
209+
],
210+
},
211+
{
212+
text: 'How-to Guides',
213+
icon: 'mdi:compass',
214+
prefix: '/how-to/',
215+
items: [
216+
{ text: 'Set up Cloudflare CDN', link: 'setup-cloudflare-cdn', icon: 'mdi:cloud-outline' },
217+
{ text: 'Fix Backblaze Redirect Issue', link: 'fix-backblaze-redirect-issue', icon: 'mdi:wrench' },
218+
],
219+
},
220+
{
221+
text: 'Explanations',
222+
icon: 'mdi:lightbulb-on-outline',
223+
prefix: '/explanation/',
224+
items: [
225+
{ text: 'Backblaze B2 URL Structure', link: 'backblaze-b2-url-structure', icon: 'mdi:link-variant' },
226+
{ text: 'Proxy Origin Bypass', link: 'proxy-origin-bypass', icon: 'mdi:shield-lock-outline' },
227+
],
228+
},
229+
{
230+
text: 'Reference',
231+
icon: 'mdi:book-open-page-variant',
232+
prefix: '/reference/',
233+
collapsed: false,
234+
items: [{ text: 'Backblaze B2 Config', link: 'backblaze-b2-config', icon: 'mdi:file-cog' }],
235+
},
236+
],
237+
},
238+
40239
/**
41-
* markdown
42-
* @see https://theme-plume.vuejs.press/config/markdown/
43-
*/
240+
* markdown
241+
* @see https://theme-plume.vuejs.press/config/markdown/
242+
*/
44243
markdown: {
45244
collapse: true,
46245
timeline: true,
47-
// abbr: true, // 启用 abbr 语法 *[label]: content
48-
// annotation: true, // 启用 annotation 语法 [+label]: content
49-
// pdf: true, // 启用 PDF 嵌入 @[pdf](/xxx.pdf)
50-
// caniuse: true, // 启用 caniuse 语法 @[caniuse](feature_name)
51-
// plot: true, // 启用隐秘文本语法 !!xxxx!!
52-
// bilibili: true, // 启用嵌入 bilibili视频 语法 @[bilibili](bid)
53-
// youtube: true, // 启用嵌入 youtube视频 语法 @[youtube](video_id)
54-
// artPlayer: true, // 启用嵌入 artPlayer 本地视频 语法 @[artPlayer](url)
55-
// audioReader: true, // 启用嵌入音频朗读功能 语法 @[audioReader](url)
56-
// icons: true, // 启用内置图标语法 :[icon-name]:
57-
// codepen: true, // 启用嵌入 codepen 语法 @[codepen](user/slash)
58-
// replit: true, // 启用嵌入 replit 语法 @[replit](user/repl-name)
59-
// codeSandbox: true, // 启用嵌入 codeSandbox 语法 @[codeSandbox](id)
60-
// jsfiddle: true, // 启用嵌入 jsfiddle 语法 @[jsfiddle](user/id)
61-
// npmTo: true, // 启用 npm-to 容器 ::: npm-to
62-
// demo: true, // 启用 demo 容器 ::: demo
63-
repl: { // 启用 代码演示容器
64-
go: true, // ::: go-repl
65-
rust: true, // ::: rust-repl
66-
// kotlin: true, // ::: kotlin-repl
246+
plot: true,
247+
repl: {
248+
go: true,
249+
rust: true,
67250
},
68-
// math: { // 启用数学公式
69-
// type: 'katex',
70-
// },
71-
// chartjs: true, // 启用 chart.js
72-
// echarts: true, // 启用 ECharts
73-
mermaid: true, // 启用 mermaid
74-
// flowchart: true, // 启用 flowchart
251+
mermaid: true,
75252
image: {
76-
figure: true, // 启用 figure
77-
lazyload: true, // 启用图片懒加载
78-
mark: true, // 启用图片标记
79-
size: true, // 启用图片大小
253+
figure: true,
254+
lazyload: true,
255+
mark: true,
256+
size: true,
80257
},
81-
// include: true, // 在 Markdown 文件中导入其他 markdown 文件内容
82-
// imageSize: 'local', // 启用 自动填充 图片宽高属性,避免页面抖动
83258
},
84259

85260
watermark: false,
86261
}),
87-
})
262+
});

docs/.vuepress/navbar.ts

Lines changed: 44 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,63 @@
1-
import { defineNavbarConfig } from 'vuepress-theme-plume'
1+
import { defineNavbarConfig } from 'vuepress-theme-plume';
22

33
export const navbar = defineNavbarConfig([
4-
{ text: 'Home', link: '/' },
4+
{ text: 'Home', link: '/', icon: 'mdi:home' },
55

66
{
77
text: 'Getting Started',
8+
icon: 'mdi:rocket-launch',
89
items: [
9-
{ text: 'Overview', link: '/guide/overview' },
10-
{ text: 'Quick Start', link: '/guide/quickstart' },
10+
{ text: 'Overview', link: '/guide/overview', icon: 'mdi:eye' },
11+
{ text: 'Quickstart', link: '/guide/quickstart', icon: 'mdi:flash' },
1112
],
1213
},
1314

1415
{
15-
text: 'References',
16+
text: 'How-to Guides',
17+
icon: 'mdi:compass',
1618
items: [
17-
{ text: 'Helm-Chart', link: '/references/helm-chart' },
18-
{ text: 'GitHub Action', link: '/references/action' },
19+
{ text: 'Setup Cloudflare CDN', link: '/how-to/setup-cloudflare-cdn', icon: 'mdi:cloud-outline' },
20+
{ text: 'Fix Backblaze Redirect Issue', link: '/how-to/fix-backblaze-redirect-issue', icon: 'mdi:wrench' },
1921
],
2022
},
2123

2224
{
23-
text: 'Download',
24-
link: 'https://github.com/SpechtLabs/StaticPages/releases',
25-
target: '_blank',
26-
rel: 'noopener noreferrer',
25+
text: 'Explanations',
26+
icon: 'mdi:lightbulb-outline',
27+
items: [
28+
{ text: 'Backblaze B2 URL Structure', link: '/explanation/backblaze-b2-url-structure', icon: 'mdi:link-variant' },
29+
{ text: 'Proxy Origin Bypass', link: '/explanation/proxy-origin-bypass', icon: 'mdi:shield-lock-outline' },
30+
],
2731
},
2832

2933
{
30-
text: 'Report an Issue',
31-
link: 'https://github.com/SpechtLabs/StaticPages/issues/new/choose',
32-
target: '_blank',
33-
rel: 'noopener noreferrer',
34+
text: 'Reference',
35+
icon: 'mdi:book-open-page-variant',
36+
items: [
37+
{ text: 'Backblaze B2 Config', link: '/reference/backblaze-b2-config', icon: 'mdi:file-cog' },
38+
{ text: 'Helm Chart', link: '/references/helm-chart', icon: 'mdi:kubernetes' },
39+
{ text: 'GitHub Action', link: '/references/action', icon: 'mdi:github' },
40+
],
41+
},
42+
43+
{
44+
text: 'More',
45+
icon: 'mdi:dots-horizontal',
46+
items: [
47+
{
48+
text: 'Download',
49+
link: 'https://github.com/SpechtLabs/StaticPages/releases',
50+
target: '_blank',
51+
rel: 'noopener noreferrer',
52+
icon: 'mdi:download',
53+
},
54+
{
55+
text: 'Report an Issue',
56+
link: 'https://github.com/SpechtLabs/StaticPages/issues/new/choose',
57+
target: '_blank',
58+
rel: 'noopener noreferrer',
59+
icon: 'mdi:bug-outline',
60+
},
61+
],
3462
},
35-
])
63+
]);

0 commit comments

Comments
 (0)