Skip to content

Commit 9bc03e9

Browse files
committed
renew the website.
1 parent 3c34457 commit 9bc03e9

78 files changed

Lines changed: 3031 additions & 10188 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/deploy.yml‎

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
name: Deploy Docs
32

43
on:
@@ -18,18 +17,15 @@ jobs:
1817
# if your docs needs submodules, uncomment the following line
1918
# submodules: true
2019

21-
2220
- name: Install pnpm
23-
uses: pnpm/action-setup@v2
21+
uses: pnpm/action-setup@v4
2422
with:
25-
version: 8
26-
run_install: true
27-
23+
version: 10
2824

2925
- name: Setup Node.js
30-
uses: actions/setup-node@v3
26+
uses: actions/setup-node@v4
3127
with:
32-
node-version: 16
28+
node-version: 22
3329
cache: pnpm
3430

3531
- name: Install Deps
@@ -45,4 +41,4 @@ jobs:
4541
with:
4642
# This is the branch where the docs are deployed to
4743
branch: gh-pages
48-
folder: docs/.vuepress/dist
44+
folder: docs/.vitepress/dist

‎.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
node_modules
2+
docs/.vitepress/dist
3+
docs/.vitepress/cache

‎docs/.vitepress/config.mts‎

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
import { defineConfig } from 'vitepress'
2+
3+
const searchZh = {
4+
translations: {
5+
button: { buttonText: '搜索文档', buttonAriaLabel: '搜索文档' },
6+
modal: {
7+
displayDetails: '显示详细列表',
8+
resetButtonTitle: '重置搜索',
9+
backButtonTitle: '关闭搜索',
10+
noResultsText: '没有找到结果:',
11+
footer: {
12+
selectText: '选择',
13+
selectKeyAriaLabel: '回车',
14+
navigateText: '切换',
15+
navigateUpKeyAriaLabel: '上箭头',
16+
navigateDownKeyAriaLabel: '下箭头',
17+
closeText: '关闭',
18+
closeKeyAriaLabel: 'Esc'
19+
}
20+
}
21+
}
22+
}
23+
24+
export default defineConfig({
25+
title: 'BedrockDev',
26+
description: 'Trapdoor & BedrockMap 文档',
27+
// bm 教程暂未上线,先不构建(源文件保留在 bm/guide/)
28+
srcExclude: ['bm/guide/**'],
29+
// 顶层 themeConfig 是所有语言共用的默认值,会被各 locale 覆盖
30+
themeConfig: {
31+
logo: '/imgs/logo.svg',
32+
search: {
33+
provider: 'local',
34+
options: { locales: { root: searchZh } }
35+
}
36+
},
37+
locales: {
38+
root: {
39+
label: '简体中文',
40+
lang: 'zh-CN',
41+
title: 'BedrockDev',
42+
description: 'Trapdoor & BedrockMap 文档',
43+
themeConfig: {
44+
// 英文只有首页和 bm,按路径映射会指向不存在的页面,统一切到语言首页
45+
i18nRouting: false,
46+
nav: [
47+
{ text: 'Trapdoor', link: '/tr/' },
48+
{ text: 'BedrockMap', link: '/bm/' },
49+
{ text: '文章', link: '/docs/' }
50+
],
51+
sidebar: {
52+
'/tr/': [
53+
{
54+
text: '基本使用',
55+
collapsed: false,
56+
items: [
57+
{ text: '1. 介绍', link: '/tr/' },
58+
{ text: '2. 安装和使用', link: '/tr/use' },
59+
{ text: '3. 功能介绍', link: '/tr/func' },
60+
{ text: '4. 配置和自定义', link: '/tr/config' }
61+
]
62+
},
63+
{
64+
text: '高级功能',
65+
collapsed: false,
66+
items: [
67+
{ text: '5. Shortcuts', link: '/tr/shortcuts' },
68+
{ text: '6. 假人脚本', link: '/tr/scripts' },
69+
{ text: '7. 数据缓存', link: '/tr/cache_data' },
70+
{ text: '8. 开发和部署', link: '/tr/dev' },
71+
{ text: '9. Q&A', link: '/tr/q&a' }
72+
]
73+
},
74+
{
75+
text: '外部链接',
76+
collapsed: false,
77+
items: [
78+
{ text: '源码', link: 'https://github.com/bedrock-dev/trapdoor-ll' },
79+
{ text: '下载', link: '/tr/download' }
80+
]
81+
}
82+
]
83+
},
84+
outline: {
85+
level: [2, 3],
86+
label: '本页目录'
87+
},
88+
docFooter: {
89+
prev: '上一篇',
90+
next: '下一篇'
91+
},
92+
darkModeSwitchLabel: '外观',
93+
returnToTopLabel: '返回顶部',
94+
sidebarMenuLabel: '菜单',
95+
skipToContentLabel: '跳到正文',
96+
langMenuLabel: '切换语言'
97+
}
98+
},
99+
en: {
100+
label: 'English',
101+
lang: 'en-US',
102+
title: 'BedrockDev',
103+
description: 'Trapdoor and BedrockMap documentation',
104+
themeConfig: {
105+
i18nRouting: false,
106+
nav: [{ text: 'BedrockMap', link: '/en/bm/' }],
107+
outline: {
108+
level: [2, 3],
109+
label: 'On this page'
110+
},
111+
docFooter: {
112+
prev: 'Previous page',
113+
next: 'Next page'
114+
},
115+
darkModeSwitchLabel: 'Appearance',
116+
returnToTopLabel: 'Return to top',
117+
sidebarMenuLabel: 'Menu',
118+
skipToContentLabel: 'Skip to content',
119+
langMenuLabel: 'Change language'
120+
}
121+
}
122+
}
123+
})

‎docs/.vitepress/theme/Layout.vue‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<script setup>
2+
import DefaultTheme from 'vitepress/theme'
3+
import { useData } from 'vitepress'
4+
import BmHome from './components/BmHome.vue'
5+
import BmGuide from './components/BmGuide.vue'
6+
import BmArticle from './components/BmArticle.vue'
7+
8+
const { frontmatter } = useData()
9+
const DefaultLayout = DefaultTheme.Layout
10+
</script>
11+
12+
<template>
13+
<BmHome v-if="frontmatter.layout === 'bm-home'" />
14+
<BmGuide v-else-if="frontmatter.layout === 'bm-guide'" />
15+
<BmArticle v-else-if="frontmatter.layout === 'bm-article'" />
16+
<DefaultLayout v-else />
17+
</template>
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
<script setup>
2+
import { computed } from "vue";
3+
import { Content, useData } from "vitepress";
4+
import BmNav from "./BmNav.vue";
5+
6+
const { frontmatter } = useData();
7+
const prev = computed(() => frontmatter.value.prev);
8+
const next = computed(() => frontmatter.value.next);
9+
10+
const navLinks = [
11+
{ text: "主页", href: "/bm/" },
12+
{ text: "教程列表", href: "/bm/guide/" },
13+
{ text: "快捷键", href: "/bm/#shortcuts" },
14+
{
15+
text: "源码",
16+
href: "https://github.com/bedrock-dev/BedrockMap",
17+
external: true,
18+
},
19+
];
20+
</script>
21+
22+
<template>
23+
<div class="bm">
24+
<BmNav :links="navLinks" />
25+
26+
<article class="bm-article">
27+
<a class="bm-back" href="/bm/guide/">← 返回教程列表</a>
28+
<div class="vp-doc">
29+
<Content />
30+
</div>
31+
32+
<nav class="bm-pager">
33+
<a v-if="prev" :href="prev.link">
34+
<span>上一篇</span>
35+
{{ prev.text }}
36+
</a>
37+
<a v-if="next" class="bm-next" :href="next.link">
38+
<span>下一篇</span>
39+
{{ next.text }}
40+
</a>
41+
</nav>
42+
</article>
43+
</div>
44+
</template>
45+
46+
<style scoped>
47+
.bm {
48+
--bm-max: 1120px;
49+
min-height: 100vh;
50+
background: var(--vp-c-bg);
51+
}
52+
53+
.bm-article {
54+
max-width: 780px;
55+
margin: 0 auto;
56+
padding: 40px 24px 96px;
57+
}
58+
59+
.bm-back {
60+
display: inline-block;
61+
margin-bottom: 26px;
62+
font-size: 13.5px;
63+
color: var(--vp-c-text-3);
64+
text-decoration: none;
65+
transition: color 0.2s;
66+
}
67+
.bm-back:hover {
68+
color: var(--vp-c-brand-1);
69+
}
70+
71+
/* vp-doc 默认给 h1 加了上边框和超大字号,这里按文章页收一收 */
72+
.bm-article :deep(.vp-doc h1) {
73+
margin: 0 0 8px;
74+
padding-top: 0;
75+
border-top: 0;
76+
font-size: clamp(26px, 4vw, 34px);
77+
letter-spacing: -0.02em;
78+
}
79+
80+
.bm-pager {
81+
display: flex;
82+
flex-wrap: wrap;
83+
gap: 12px;
84+
justify-content: space-between;
85+
margin-top: 56px;
86+
padding-top: 24px;
87+
border-top: 1px solid var(--vp-c-divider);
88+
}
89+
.bm-pager a {
90+
display: flex;
91+
flex-direction: column;
92+
gap: 4px;
93+
padding: 12px 18px;
94+
border: 1px solid var(--vp-c-divider);
95+
border-radius: 10px;
96+
font-size: 14px;
97+
font-weight: 600;
98+
color: var(--vp-c-text-1);
99+
text-decoration: none;
100+
transition:
101+
border-color 0.2s,
102+
color 0.2s;
103+
}
104+
.bm-pager a:hover {
105+
border-color: var(--vp-c-brand-1);
106+
color: var(--vp-c-brand-1);
107+
}
108+
.bm-pager span {
109+
font-size: 12px;
110+
font-weight: 500;
111+
letter-spacing: 0.04em;
112+
color: var(--vp-c-text-3);
113+
}
114+
.bm-next {
115+
margin-left: auto;
116+
text-align: right;
117+
}
118+
119+
@media (max-width: 640px) {
120+
.bm-article {
121+
padding: 28px 20px 72px;
122+
}
123+
}
124+
</style>

0 commit comments

Comments
 (0)