Skip to content

Commit 135b936

Browse files
committed
Update docs: merge english docs to one project
1 parent a5bb94c commit 135b936

25 files changed

+552
-305
lines changed

docs/.vitepress/config.mts

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
import { defineConfig } from 'vitepress';
2+
import { renderSandbox } from 'vitepress-plugin-sandpack';
3+
import container from 'markdown-it-container';
4+
5+
export default defineConfig({
6+
base: '/pages/vue3-context-menu-docs/',
7+
lang: 'zh-CN',
8+
title: 'vue3-context-menu',
9+
description: '一个使用 Vue3 制作的简洁美观简单的右键菜单组件',
10+
locales: {
11+
root: {
12+
label: '中文',
13+
lang: 'zh',
14+
},
15+
en: {
16+
label: 'English',
17+
lang: 'en',
18+
description: 'A simple, beautiful and simple context menu component made by Vue3',
19+
themeConfig: {
20+
socialLinks: [
21+
{ icon: 'github', link: 'https://github.com/imengyu/vue3-context-menu' },
22+
],
23+
footer: {
24+
message: 'Released under the MIT License.',
25+
copyright: 'Copyright © 2022 imengyu.top'
26+
},
27+
nav: [
28+
{ text: 'Guide', link: '/guide/install' },
29+
{ text: 'API Reference', link: '/api/ContextMenu' },
30+
{ text: 'Changelog', link: '/change/index' },
31+
],
32+
sidebar: {
33+
'/en/guide/': [
34+
{
35+
text: 'Start',
36+
items: [
37+
{ text: 'Install', link: '/en/guide/install' },
38+
{ text: 'Useage', link: '/en/guide/useage' },
39+
{ text: 'Menu icon', link: '/en/guide/icon' },
40+
]
41+
},
42+
{
43+
text: 'Theme and Customize',
44+
items: [
45+
{ text: 'Theme', link: '/en/guide/theme' },
46+
{ text: 'Customize Styles and Rendering', link: '/en/guide/customize' },
47+
{ text: 'Customize the menu mount container', link: '/en/guide/custom-container' },
48+
]
49+
},
50+
],
51+
'/en/api/': [
52+
{
53+
text: 'API Reference',
54+
items: [
55+
{ text: 'Function mode', link: '/en/api/ContextMenuInstance' },
56+
{
57+
text: 'Component mode',
58+
items: [
59+
{ text: 'ContextMenu', link: '/en/api/ContextMenu' },
60+
{ text: 'ContextMenuGroup', link: '/en/api/ContextMenuGroup' },
61+
{ text: 'ContextMenuItem', link: '/en/api/ContextMenuItem' },
62+
{ text: 'ContextMenuSeparator', link: '/en/api/ContextMenuSeparator' },
63+
{ text: 'MenuBar', link: '/en/api/MenuBar' },
64+
]
65+
},
66+
]
67+
},
68+
]
69+
}
70+
}
71+
},
72+
},
73+
themeConfig: {
74+
socialLinks: [
75+
{
76+
icon: {
77+
svg: '<svg role="img" viewBox="0 0 1024 1024"><path d="M512 1024C229.222 1024 0 794.778 0 512S229.222 0 512 0s512 229.222 512 512-229.222 512-512 512z m259.149-568.883h-290.74a25.293 25.293 0 0 0-25.292 25.293l-0.026 63.206c0 13.952 11.315 25.293 25.267 25.293h177.024c13.978 0 25.293 11.315 25.293 25.267v12.646a75.853 75.853 0 0 1-75.853 75.853h-240.23a25.293 25.293 0 0 1-25.267-25.293V417.203a75.853 75.853 0 0 1 75.827-75.853h353.946a25.293 25.293 0 0 0 25.267-25.292l0.077-63.207a25.293 25.293 0 0 0-25.268-25.293H417.152a189.62 189.62 0 0 0-189.62 189.645V771.15c0 13.977 11.316 25.293 25.294 25.293h372.94a170.65 170.65 0 0 0 170.65-170.65V480.384a25.293 25.293 0 0 0-25.293-25.267z"/></svg>'
78+
},
79+
link: 'https://gitee.com/imengyu/vue3-context-menu'
80+
},
81+
{ icon: 'github', link: 'https://github.com/imengyu/vue3-context-menu' },
82+
],
83+
footer: {
84+
message: 'Released under the MIT License.',
85+
copyright: 'Copyright © 2022 imengyu.top'
86+
},
87+
nav: [
88+
{ text: '教程', link: '/guide/install' },
89+
{ text: 'API 参考', link: '/api/ContextMenu' },
90+
{ text: '更新日志', link: '/change/index' },
91+
],
92+
sidebar: {
93+
'/guide/': [
94+
{
95+
text: '起步',
96+
items: [
97+
{ text: '开始之前', link: '/guide/start' },
98+
{ text: '安装', link: '/guide/install' },
99+
{ text: '如何使用', link: '/guide/useage' },
100+
{ text: '菜单图标', link: '/guide/icon' },
101+
]
102+
},
103+
{
104+
text: '美化与自定义',
105+
items: [
106+
{ text: '主题', link: '/guide/theme' },
107+
{ text: '自定义样式和渲染', link: '/guide/customize' },
108+
{ text: '自定义菜单挂载容器', link: '/guide/custom-container' },
109+
]
110+
},
111+
],
112+
'/api/': [
113+
{
114+
text: 'API 参考',
115+
items: [
116+
{ text: '函数模式', link: '/api/ContextMenuInstance' },
117+
{
118+
text: '组件模式',
119+
items: [
120+
{ text: 'ContextMenu', link: '/api/ContextMenu' },
121+
{ text: 'ContextMenuGroup', link: '/api/ContextMenuGroup' },
122+
{ text: 'ContextMenuItem', link: '/api/ContextMenuItem' },
123+
{ text: 'ContextMenuSeparator', link: '/api/ContextMenuSeparator' },
124+
{ text: 'MenuBar', link: '/api/MenuBar' },
125+
]
126+
},
127+
]
128+
},
129+
]
130+
},
131+
},
132+
markdown: {
133+
config(md) {
134+
md
135+
// the second parameter is html tag name
136+
.use(container, 'sandbox', {
137+
render (tokens, idx) {
138+
return renderSandbox(tokens, idx, 'sandbox');
139+
},
140+
})
141+
.use(container, 'my-sandbox', {
142+
render (tokens, idx) {
143+
return renderSandbox(tokens, idx, 'my-sandbox');
144+
},
145+
});
146+
},
147+
},
148+
});

docs/.vitepress/theme/MySandbox.vue

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!-- MySandbox.vue -->
2+
<template>
3+
<!-- 'code-options' is a build-in prop, do not edit it -->
4+
<Sandbox
5+
:rtl="rtl"
6+
:template="template"
7+
:light-theme="lightTheme"
8+
:dark-theme="darkTheme"
9+
:options="{
10+
...props, // do not forget it
11+
showLineNumbers: true,
12+
}"
13+
:custom-setup="{
14+
...props, // do not forget it
15+
deps: { '@imengyu/vue3-context-menu': 'latest' }
16+
}"
17+
:code-options="codeOptions"
18+
>
19+
<slot />
20+
</Sandbox>
21+
</template>
22+
23+
<script setup lang="ts">
24+
import { Sandbox, sandboxProps } from 'vitepress-plugin-sandpack';
25+
26+
const props = defineProps(sandboxProps);
27+
</script>

docs/.vitepress/theme/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import DefaultTheme from 'vitepress/theme';
2+
import MySandbox from './MySandbox.vue';
3+
import { Sandbox } from 'vitepress-plugin-sandpack';
4+
import 'vitepress-plugin-sandpack/dist/style.css';
5+
6+
export default {
7+
...DefaultTheme,
8+
enhanceApp(ctx) {
9+
DefaultTheme.enhanceApp(ctx);
10+
ctx.app.component('Sandbox', Sandbox);
11+
ctx.app.component('MySandbox', MySandbox);
12+
},
13+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)