Skip to content

Commit 180496b

Browse files
committed
docs: 添加 git 更改日志插件并优化文档配置
- 添加 @nolebase/vitepress-plugin-git-changelog 插件- 更新 Vitepress 配置,集成 Git 更改日志功能 - 新增编辑链接和最后更新时间配置 - 创建自定义主题以支持 Git 更改日志 - 添加 TypeScript 配置文件
1 parent 8d18df9 commit 180496b

File tree

4 files changed

+58
-2
lines changed

4 files changed

+58
-2
lines changed

docs/.vitepress/config.ts

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
1-
// https://vitepress.dev/reference/site-config
2-
export default ({
1+
import { defineConfig } from 'vitepress'
2+
import {
3+
GitChangelog,
4+
GitChangelogMarkdownSection,
5+
} from '@nolebase/vitepress-plugin-git-changelog/vite'
6+
7+
export default defineConfig({
8+
vite: {
9+
plugins: [
10+
GitChangelog({
11+
repoURL: () => 'https://github.com/MuRainBot/MuRainBot2Doc',
12+
}),
13+
GitChangelogMarkdownSection(),
14+
],
15+
},
16+
lang: 'zh-CN',
317
title: "MuRainBot2 Doc",
418
description: "MuRainBot2's Doc",
519
themeConfig: {
@@ -51,6 +65,15 @@ export default ({
5165
search: {
5266
provider: 'local'
5367
},
68+
69+
editLink: {
70+
pattern: 'https://github.com/MuRainBot/MuRainBot2Doc/edit/master/docs/:path',
71+
text: '帮助我们改进此文档'
72+
},
73+
74+
lastUpdated: {
75+
text: '最后更新于'
76+
}
5477
},
5578
cleanUrls: true
5679
})

docs/.vitepress/theme/index.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import DefaultTheme from 'vitepress/theme'
2+
import type { Theme as ThemeConfig } from 'vitepress'
3+
import {
4+
NolebaseGitChangelogPlugin
5+
} from '@nolebase/vitepress-plugin-git-changelog/client'
6+
7+
import '@nolebase/vitepress-plugin-git-changelog/client/style.css'
8+
9+
export const Theme: ThemeConfig = {
10+
extends: DefaultTheme,
11+
enhanceApp({ app }) {
12+
app.use(NolebaseGitChangelogPlugin);
13+
},
14+
15+
}
16+
17+
export default Theme

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
{
2+
"type": "module",
23
"scripts": {
34
"docs:dev": "vitepress dev docs",
45
"docs:build": "vitepress build docs",
56
"docs:preview": "vitepress preview docs"
67
},
78
"devDependencies": {
9+
"@nolebase/vitepress-plugin-git-changelog": "^2.17.0",
810
"vitepress": "^1.5.0"
911
},
1012
"dependencies": {

tsconfig.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"compilerOptions": {
3+
"module": "ESNext",
4+
"moduleResolution": "Bundler",
5+
},
6+
"include": [
7+
"**/.vitepress/**/*.ts",
8+
"**/.vitepress/**/*.mts",
9+
"**/.vitepress/**/*.vue"
10+
],
11+
"exclude": [
12+
"node_modules"
13+
]
14+
}

0 commit comments

Comments
 (0)