From de9cf5f3767bbab3628e33d491a346a0bee8caf8 Mon Sep 17 00:00:00 2001 From: Cubebanyasz <59843249+misike12@users.noreply.github.com> Date: Sat, 28 Dec 2024 13:29:19 +0100 Subject: [PATCH] Code clean up --- docs/.vitepress/config.mts | 31 ++++++++----------------------- docs/.vitepress/theme/index.ts | 12 ++---------- docs/devtest.md | 2 -- docs/vite.config.js | 12 ++++++++++-- 4 files changed, 20 insertions(+), 37 deletions(-) diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts index 254e56e3..3cf032b2 100644 --- a/docs/.vitepress/config.mts +++ b/docs/.vitepress/config.mts @@ -4,36 +4,24 @@ import { BiDirectionalLinks } from '@nolebase/markdown-it-bi-directional-links' import { tabsMarkdownPlugin } from 'vitepress-plugin-tabs' import { InlineLinkPreviewElementTransform } from '@nolebase/vitepress-plugin-inline-link-preview/markdown-it' import { GitChangelog, GitChangelogMarkdownSection } from '@nolebase/vitepress-plugin-git-changelog/vite' +import { PageProperties } from '@nolebase/vitepress-plugin-page-properties/vite' -// https://vitepress.dev/reference/site-config export default defineConfig({ extends: { vite: { plugins: [ GitChangelog({ - // Fill in your repository URL here repoURL: () => 'https://github.com/openm-project/mcdoc.github.io', - }), + }) as any, GitChangelogMarkdownSection({ sections: { disableChangelog: false, disableContributors: true, }, - }), + }) as any, + PageProperties(), ], - build: { - rollupOptions: { - output: { - assetFileNames: (assetInfo) => { - if (assetInfo.name.endsWith('.css')) { - return `assets/css/[name][extname]` - } - return `assets/[name][extname]` - } - } - } - }, }, }, @@ -67,7 +55,6 @@ export default defineConfig({ ], themeConfig: { - // https://vitepress.dev/reference/default-theme-config logo: '/favicon.ico', siteTitle: 'MCDOC', nav: [ @@ -159,7 +146,6 @@ export default defineConfig({ copyright: 'Copyright © 2024 OpenM Project', }, - // Page - Next & Previous Buttons docFooter: { prev: 'Prev', next: 'Next', @@ -195,17 +181,16 @@ export default defineConfig({ timeStyle: 'medium' } }, - }, markdown: { lineNumbers: true, config: (md) => { - md.use(timeline); - md.use(BiDirectionalLinks()) - md.use(InlineLinkPreviewElementTransform) - md.use(tabsMarkdownPlugin) + md.use(timeline as any); + md.use(BiDirectionalLinks() as any); + md.use(InlineLinkPreviewElementTransform as any); + md.use(tabsMarkdownPlugin as any); }, image: { diff --git a/docs/.vitepress/theme/index.ts b/docs/.vitepress/theme/index.ts index 24e1bd30..677db19c 100644 --- a/docs/.vitepress/theme/index.ts +++ b/docs/.vitepress/theme/index.ts @@ -1,4 +1,3 @@ -// https://vitepress.dev/guide/custom-theme import { h, onMounted, watch, nextTick, toRefs} from 'vue' import { useData , useRoute } from 'vitepress' import type { Theme } from 'vitepress' @@ -40,7 +39,6 @@ export default { app.component('xgplayer' , xgplayer) app.component('vImageViewer', vImageViewer); app.provide(InjectionKey, { - // Configuration defaultMode: 'LayoutMode.Original', diableAnimation: false, } as Options) @@ -50,15 +48,11 @@ export default { newestOnTop: true, }; app.use(Toast, options); - app.use(NolebaseGitChangelogPlugin) app.use(NolebaseInlineLinkPreviewPlugin) - app.use(NolebaseGitChangelogPlugin, { - // Configuration - }) + app.use(NolebaseGitChangelogPlugin, {}) app.use(autoAnimatePlugin) enhanceAppWithTabs(app) vitepressBackToTop({ - // default threshold:300 }) }, @@ -97,9 +91,7 @@ export default { } return h(DefaultTheme.Layout, props, { - // A enhanced readabilities menu for wider screens - 'nav-bar-content-after': () => h(NolebaseEnhancedReadabilitiesMenu), - // A enhanced readabilities menu for narrower screens (usually smaller than iPad Mini) + 'nav-bar-content-after': () => h(NolebaseEnhancedReadabilitiesMenu), 'nav-screen-content-after': () => h(NolebaseEnhancedReadabilitiesScreenMenu), 'layout-top': () => [ h(NolebaseHighlightTargetedHeading), diff --git a/docs/devtest.md b/docs/devtest.md index bc343f53..81fbf474 100644 --- a/docs/devtest.md +++ b/docs/devtest.md @@ -6,11 +6,9 @@ title: Development test Page import * as pkg from "vue-toastification" const { useToast } = pkg -// Get toast interface const toast = useToast(); const myMethod = () => { - // Since you returned `toast` from setup(), you can access it now toast("Test!", { timeout: 2000, closeOnClick: true, diff --git a/docs/vite.config.js b/docs/vite.config.js index 3708d9e5..66181baa 100644 --- a/docs/vite.config.js +++ b/docs/vite.config.js @@ -43,8 +43,16 @@ export default defineConfig(() => { }, build: { chunkSizeWarningLimit: 100000000, + rollupOptions: { + output: { + assetFileNames: (assetInfo) => { + if (assetInfo.name.endsWith('.css')) { + return `assets/css/[name][extname]` + } + return `assets/[name][extname]` + } + } + }, }, - plugins: [ - ], } }) \ No newline at end of file