Skip to content

Commit b02cd0f

Browse files
committed
docs: add markdown guide and refine docs structure
1 parent 9ac3e4a commit b02cd0f

File tree

23 files changed

+1110
-55
lines changed

23 files changed

+1110
-55
lines changed

docs/.vuepress/configs/navbar/en.ts

Lines changed: 61 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,77 @@ export const en: NavbarConfig = [
99
text: 'Reference',
1010
children: [
1111
{
12-
text: 'CLI',
13-
link: '/reference/cli.html',
14-
},
15-
{
16-
text: 'Config',
17-
link: '/reference/config.html',
18-
},
19-
{
20-
text: 'Frontmatter',
21-
link: '/reference/frontmatter.html',
12+
text: 'VuePress',
13+
children: [
14+
{
15+
text: 'CLI',
16+
link: '/reference/cli.html',
17+
},
18+
{
19+
text: 'Config',
20+
link: '/reference/config.html',
21+
},
22+
{
23+
text: 'Frontmatter',
24+
link: '/reference/frontmatter.html',
25+
},
26+
{
27+
text: 'Built-in Components',
28+
link: '/reference/components.html',
29+
},
30+
],
2231
},
2332
{
2433
text: 'Default Theme',
25-
link: '/reference/default-theme.html',
34+
children: [
35+
{
36+
text: 'Config',
37+
link: '/reference/default-theme/config.html',
38+
},
39+
{
40+
text: 'Frontmatter',
41+
link: '/reference/default-theme/frontmatter.html',
42+
},
43+
{
44+
text: 'Built-in Components',
45+
link: '/reference/default-theme/components.html',
46+
},
47+
],
2648
},
2749
],
2850
},
2951
{
3052
text: 'Learn More',
3153
children: [
32-
'/contributing.md',
3354
{
34-
text: 'Changelog',
35-
link:
36-
'https://github.com/vuepress/vuepress-next/blob/main/CHANGELOG.md',
55+
text: 'Advanced',
56+
children: ['/advanced/markdown.md'],
57+
},
58+
{
59+
text: 'Developer',
60+
children: ['/contributing.md'],
61+
},
62+
{
63+
text: 'Resources',
64+
children: [
65+
{
66+
text: 'Changelog',
67+
link:
68+
'https://github.com/vuepress/vuepress-next/blob/main/CHANGELOG.md',
69+
},
70+
{
71+
text: 'Awesome VuePress',
72+
link: 'https://github.com/vuepress/awesome-vuepress',
73+
},
74+
{
75+
text: 'v1 docs',
76+
link: 'https://v1.vuepress.vuejs.org',
77+
},
78+
{
79+
text: 'v0 dos',
80+
link: 'https://v0.vuepress.vuejs.org',
81+
},
82+
],
3783
},
3884
],
3985
},

docs/.vuepress/configs/navbar/zh.ts

Lines changed: 61 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,77 @@ export const zh: NavbarConfig = [
99
text: '参考',
1010
children: [
1111
{
12-
text: '命令行接口',
13-
link: '/zh/reference/cli.html',
14-
},
15-
{
16-
text: '配置',
17-
link: '/zh/reference/config.html',
18-
},
19-
{
20-
text: 'Frontmatter',
21-
link: '/zh/reference/frontmatter.html',
12+
text: 'VuePress',
13+
children: [
14+
{
15+
text: '命令行接口',
16+
link: '/zh/reference/cli.html',
17+
},
18+
{
19+
text: '配置',
20+
link: '/zh/reference/config.html',
21+
},
22+
{
23+
text: 'Frontmatter',
24+
link: '/zh/reference/frontmatter.html',
25+
},
26+
{
27+
text: '内置组件',
28+
link: '/zh/reference/components.html',
29+
},
30+
],
2231
},
2332
{
2433
text: '默认主题',
25-
link: '/zh/reference/default-theme.html',
34+
children: [
35+
{
36+
text: '配置',
37+
link: '/zh/reference/default-theme/config.html',
38+
},
39+
{
40+
text: 'Frontmatter',
41+
link: '/zh/reference/default-theme/frontmatter.html',
42+
},
43+
{
44+
text: '内置组件',
45+
link: '/zh/reference/default-theme/components.html',
46+
},
47+
],
2648
},
2749
],
2850
},
2951
{
3052
text: '了解更多',
3153
children: [
32-
'/zh/contributing.md',
3354
{
34-
text: '更新日志',
35-
link:
36-
'https://github.com/vuepress/vuepress-next/blob/main/CHANGELOG.md',
55+
text: '深入',
56+
children: ['/zh/advanced/markdown.md'],
57+
},
58+
{
59+
text: '开发者',
60+
children: ['/zh/contributing.md'],
61+
},
62+
{
63+
text: '其他资源',
64+
children: [
65+
{
66+
text: '更新日志',
67+
link:
68+
'https://github.com/vuepress/vuepress-next/blob/main/CHANGELOG.md',
69+
},
70+
{
71+
text: 'Awesome VuePress',
72+
link: 'https://github.com/vuepress/awesome-vuepress',
73+
},
74+
{
75+
text: 'v1 文档',
76+
link: 'https://v1.vuepress.vuejs.org/zh/',
77+
},
78+
{
79+
text: 'v0 文档',
80+
link: 'https://v0.vuepress.vuejs.org/zh/',
81+
},
82+
],
3783
},
3884
],
3985
},

docs/.vuepress/configs/sidebar/en.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,31 @@ export const en: SidebarConfig = {
2020
'/reference/': [
2121
{
2222
isGroup: true,
23-
text: 'Reference',
23+
text: 'VuePress Reference',
2424
children: [
2525
'/reference/cli.md',
2626
'/reference/config.md',
2727
'/reference/frontmatter.md',
28-
'/reference/default-theme.md',
28+
'/reference/components.md',
2929
],
3030
},
3131
],
32+
'/reference/default-theme/': [
33+
{
34+
isGroup: true,
35+
text: 'Default Theme Reference',
36+
children: [
37+
'/reference/default-theme/config.md',
38+
'/reference/default-theme/frontmatter.md',
39+
'/reference/default-theme/components.md',
40+
],
41+
},
42+
],
43+
'/advanced/': [
44+
{
45+
isGroup: true,
46+
text: 'Advanced',
47+
children: ['/advanced/markdown.md'],
48+
},
49+
],
3250
}

docs/.vuepress/configs/sidebar/zh.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,31 @@ export const zh: SidebarConfig = {
2020
'/zh/reference/': [
2121
{
2222
isGroup: true,
23-
text: '参考',
23+
text: 'VuePress 参考',
2424
children: [
2525
'/zh/reference/cli.md',
2626
'/zh/reference/config.md',
2727
'/zh/reference/frontmatter.md',
28-
'/zh/reference/default-theme.md',
28+
'/zh/reference/components.md',
2929
],
3030
},
3131
],
32+
'/zh/reference/default-theme/': [
33+
{
34+
isGroup: true,
35+
text: '默认主题参考',
36+
children: [
37+
'/zh/reference/default-theme/config.md',
38+
'/zh/reference/default-theme/frontmatter.md',
39+
'/zh/reference/default-theme/components.md',
40+
],
41+
},
42+
],
43+
'/zh/advanced/': [
44+
{
45+
isGroup: true,
46+
text: '深入',
47+
children: ['/zh/advanced/markdown.md'],
48+
},
49+
],
3250
}

docs/advanced/markdown.md

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# Markdown and Vue SFC
2+
3+
Each Markdown file is first compiled into HTML, and then converted to a Vue SFC. In other words, you can take Markdown as Vue SFC:
4+
5+
- Blocks `<script>` and `<style>` are treated as Vue SFC blocks as they are.
6+
- Everything outside `<script>` and `<style>` will be compiled into HTML, and be treated as Vue SFC `<template>` block.
7+
8+
Here comes an example:
9+
10+
**Input**
11+
12+
```vue
13+
_Hello, {{ msg }}_
14+
15+
<RedDiv>
16+
17+
_Current count is: {{ count }}_
18+
19+
</RedDiv>
20+
21+
<button @click="count++">Click Me!</button>
22+
23+
<script>
24+
import { h, ref } from 'vue'
25+
26+
const RedDiv = (_, ctx) => h(
27+
'div',
28+
{
29+
class: 'red-div',
30+
},
31+
ctx.slots.default()
32+
)
33+
34+
export default {
35+
components: {
36+
RedDiv,
37+
},
38+
39+
setup() {
40+
const msg = 'Vue in Markdown'
41+
const count = ref(0)
42+
43+
return {
44+
msg,
45+
count,
46+
}
47+
}
48+
}
49+
</script>
50+
51+
<style>
52+
.red-div {
53+
color: red;
54+
}
55+
</style>
56+
```
57+
58+
**Output**
59+
60+
_Hello, {{ msg }}_
61+
62+
<RedDiv>
63+
64+
_Current count is: {{ count }}_
65+
66+
</RedDiv>
67+
68+
<button @click="count++">Click Me!</button>
69+
70+
<script>
71+
import { h, ref } from 'vue'
72+
73+
const RedDiv = (_, ctx) => h(
74+
'div',
75+
{
76+
class: 'red-div',
77+
},
78+
ctx.slots.default()
79+
)
80+
81+
export default {
82+
components: {
83+
RedDiv,
84+
},
85+
86+
setup() {
87+
const msg = 'Vue in Markdown'
88+
const count = ref(0)
89+
90+
return {
91+
msg,
92+
count,
93+
}
94+
}
95+
}
96+
</script>
97+
98+
<style>
99+
.red-div {
100+
color: red;
101+
}
102+
</style>

docs/guide/configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,5 +80,5 @@ Theme config will be processed by VuePress theme, so it depends on the theme you
8080
If you don't specify the `theme` option of VuePress Config, the default theme will be used.
8181

8282
:::tip
83-
Check out the [Default Theme Reference](../reference/default-theme.md) for theme config of default theme.
83+
Check out the [Default Theme > Config Reference](../reference/default-theme/config.md) for theme config of default theme.
8484
:::

0 commit comments

Comments
 (0)