Skip to content

Commit

Permalink
Merge pull request #13 from project-trans/dev/git-changelog
Browse files Browse the repository at this point in the history
chore: apply @nolebase/vitepress-plugin-git-changelog plugin
  • Loading branch information
Cryolitia authored Feb 19, 2024
2 parents 5c9b904 + 582d618 commit 2428c57
Show file tree
Hide file tree
Showing 5 changed files with 1,523 additions and 1,684 deletions.
46 changes: 32 additions & 14 deletions docs/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,52 @@ import './styles/vitepress-vars.css'
import './styles/styles.css'
import 'uno.css'

import {
NolebaseHighlightTargetedHeading,
} from '@nolebase/vitepress-plugin-highlight-targeted-heading'
import {
NolebaseEnhancedReadabilitiesPlugin,
NolebaseEnhancedReadabilitiesMenu,
NolebaseEnhancedReadabilitiesScreenMenu,
} from '@nolebase/vitepress-plugin-enhanced-readabilities'

import '@nolebase/vitepress-plugin-highlight-targeted-heading/dist/style.css'
import {
NolebaseHighlightTargetedHeading,
NolebaseNolebaseHighlightTargetedHeadingPlugin,
} from '@nolebase/vitepress-plugin-highlight-targeted-heading'

import {
NolebaseEnhancedReadabilitiesMenu,
NolebaseEnhancedReadabilitiesScreenMenu,
} from '@nolebase/vitepress-plugin-enhanced-readabilities'
import {
NolebaseGitChangelogPlugin
} from '@nolebase/vitepress-plugin-git-changelog/client'

import '@nolebase/vitepress-plugin-enhanced-readabilities/dist/style.css'
import '@nolebase/vitepress-plugin-highlight-targeted-heading/dist/style.css'
import '@nolebase/vitepress-plugin-git-changelog/client/style.css'

export default {
extends: DefaultTheme,
Layout: () => {
return h(DefaultTheme.Layout, null, {
// 为较宽的屏幕的导航栏添加阅读增强菜单
'nav-bar-content-after': () => h(NolebaseEnhancedReadabilitiesMenu),
'nav-bar-content-after': () => h(NolebaseEnhancedReadabilitiesMenu),
// 为较窄的屏幕(通常是小于 iPad Mini)添加阅读增强菜单
'nav-screen-content-after': () => h(NolebaseEnhancedReadabilitiesScreenMenu),
// https://vitepress.dev/guide/extending-default-theme#layout-slots
'layout-top': () => [
h(NolebaseHighlightTargetedHeading),
],
'layout-top': () => [
h(NolebaseHighlightTargetedHeading),
],
})
},
enhanceApp() {
// ...
enhanceApp({ app }) {
app.use(NolebaseEnhancedReadabilitiesPlugin, {
spotlight: {
defaultToggle: true,
}
})
app.use(NolebaseNolebaseHighlightTargetedHeadingPlugin)
app.use(NolebaseGitChangelogPlugin, {
locales: {
'zh-CN': {
lastEditedDateFnsLocaleName: 'zhCN'
}
}
})
}
} satisfies Theme
23 changes: 22 additions & 1 deletion docs/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,38 @@ import { defineConfig } from 'vite'
import { MarkdownTransform } from './.vitepress/plugins/markdownTransform'
import Components from 'unplugin-vue-components/vite'
import UnoCSS from 'unocss/vite'
import { GitChangelog, GitChangelogMarkdownSection } from '@nolebase/vitepress-plugin-git-changelog/vite'

export default defineConfig({
plugins: [
MarkdownTransform(),
GitChangelog({
maxGitLogCount: 2000,
repoURL: () => 'https://github.com/project-trans/SOC-8',
rewritePaths: {
'docs/': 'SOC-8/',
},
}),
GitChangelogMarkdownSection({
sections: {
disableChangelog: false,
disableContributors: true,
},
getChangelogTitle: () => '变更历史',
excludes: [],
exclude: (_, { helpers }): boolean => {
if (helpers.idEquals('index.md'))
return true

return false
},
}),
Components({
dirs: resolve(__dirname, '.vitepress/theme/components'),
include: [/\.vue$/, /\.vue\?vue/, /\.md$/],
dts: './.vitepress/components.d.ts',
transformer: 'vue3',
}),

UnoCSS(),
],
})
23 changes: 12 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,26 @@
"update-package": "pnpm dlx vp-update"
},
"devDependencies": {
"@iconify-json/octicon": "^1.1.51",
"@iconify-json/octicon": "^1.1.52",
"@nolebase/vitepress-plugin-enhanced-readabilities": "^1.22.2",
"@nolebase/vitepress-plugin-git-changelog": "^1.22.2",
"@nolebase/vitepress-plugin-highlight-targeted-heading": "^1.22.2",
"@types/markdown-it": "^13.0.7",
"@types/markdown-it-footnote": "^3.0.3",
"@nolebase/vitepress-plugin-enhanced-readabilities": "^1.7.3",
"@nolebase/vitepress-plugin-highlight-targeted-heading": "^1.4.0",
"@types/markdown-it-footnote": "^3.0.4",
"katex": "^0.16.9",
"markdown-it-footnote": "^3.0.3",
"markdown-it-katex": "^2.0.3",
"markdown-it-pangu": "^1.0.2",
"typescript": "^5.3.3",
"unocss": "^0.58.0",
"unocss": "^0.58.5",
"unocss-preset-extra": "^0.5.3",
"unplugin-vue-components": "^0.26.0",
"vite": "^5.0.5",
"vitepress": "^1.0.0-rc.31",
"vitepress-sidebar": "^1.18.0",
"vue": "^3.3.8",
"vite": "^5.1.3",
"vitepress": "1.0.0-rc.42",
"vitepress-sidebar": "^1.18.6",
"vue": "^3.4.19",
"vuepress": "2.0.0-rc.0",
"vuepress-theme-hope": "2.0.0-rc.0",
"vuepress-plugin-md-enhance": "2.0.0-rc.0"
"vuepress-plugin-md-enhance": "2.0.0-rc.0",
"vuepress-theme-hope": "2.0.0-rc.0"
}
}
Loading

0 comments on commit 2428c57

Please sign in to comment.