Skip to content

Commit

Permalink
✨ feat: vitepress plugins
Browse files Browse the repository at this point in the history
nprogress, back-to-top, codeplock fold, viewerjs
  • Loading branch information
Big-Cake-jpg committed Sep 30, 2023
1 parent 5ad1af3 commit a72360b
Show file tree
Hide file tree
Showing 8 changed files with 151 additions and 118 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,3 @@
- [23355607](https://github.com/2623684696):域名管理
- [龙腾猫跃 / PCL2](https://github.com/Hex-Dragon/PCL2):提供了部分日志分析规则
- 各位志愿者:提供了很多日志分析经验,没有你们河豚分析不会成立
- [Cloudflare](https://www.cloudflare.com):提供免费的 Cloudflare Pro 计划支持
4 changes: 2 additions & 2 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { defineConfig } from "vitepress"
import { pwa } from "./scripts/pwa"

const COMMIT_ID =
process.env.CF_PAGES_COMMIT_SHA || process.env.COMMIT_REF || "local"
process.env.CF_PAGES_COMMIT_SHA || "local"
const commitRef = COMMIT_ID?.slice(0, 8)
const environment = process.env.DEPLOYMENT_STATUS || process.env.NODE_ENV

Expand Down Expand Up @@ -60,7 +60,7 @@ export default withPwa(
],

footer: {
message: `Released under the <a href="https://github.com/GlobeMC/crashmc.com/blob/main/LICENSE">GFDL License</a>.<br />GlobeMC/crashmc.com<br />${environment}@<a href="https://github.com/GlobeMC/crashmc.com/commit/${commitRef}" target="_blank" alt=${commitRef}>${commitRef}</a><br /><a href="https://www.cloudflare.com" target="_blank">Powered by Cloudflare</a>`,
message: `Released under the <a href="https://github.com/GlobeMC/crashmc.com/blob/main/LICENSE">GFDL License</a>.<br />GlobeMC/crashmc.com<br />${environment}@<a href="https://github.com/GlobeMC/crashmc.com/commit/${commitRef}" target="_blank" alt=${commitRef}>${commitRef}</a>`,
copyright:
'Copyright © 2023-present <a href="https://github.com/GlobeMC">GlobeMC / 河豚分析</a>',
},
Expand Down
69 changes: 0 additions & 69 deletions docs/.vitepress/theme/components/Comment.vue

This file was deleted.

18 changes: 18 additions & 0 deletions docs/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,17 @@ import Contributors from "./components/Contributors.vue"
import LauncherBadge from "./components/LauncherBadge.vue"
import ReloadPrompt from "./components/ReloadPrompt.vue"
import giscusTalk from "vitepress-plugin-comment-with-giscus"
import vitepressNprogress from '@andatoshiki/vitepress-plugin-nprogress'
import '@andatoshiki/vitepress-plugin-nprogress/lib/css/index.css'
import 'viewerjs/dist/viewer.min.css';
import imageViewer from 'vitepress-plugin-image-viewer';
import vImageViewer from 'vitepress-plugin-image-viewer/lib/vImageViewer.vue';
import { useData, useRoute } from "vitepress"
import codeblocksFold from 'vitepress-plugin-codeblocks-fold'; // import method
import 'vitepress-plugin-codeblocks-fold/style/index.scss'; // import style
import "./style.css"
import vitepressBackToTop from 'vitepress-plugin-back-to-top'
import 'vitepress-plugin-back-to-top/dist/style.css'

export default {
...Theme,
Expand All @@ -18,11 +27,20 @@ export default {
},
enhanceApp(ctx) {
ctx.app.component("LauncherBadge", LauncherBadge)
vitepressNprogress(ctx)
ctx.app.component('vImageViewer', vImageViewer);
vitepressBackToTop({
// default
threshold:300
})
},
setup() {
// Get frontmatter and route
const { frontmatter } = useData()
const route = useRoute()
// Using
imageViewer(route);
codeblocksFold({ route, frontmatter }, true, 400);

// Obtain configuration from: https://giscus.app/
giscusTalk(
Expand Down
2 changes: 1 addition & 1 deletion docs/client/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Minecraft 客户端,是 Minecraft 游戏本身一大组成部分。通俗来说,玩家游玩的 Minecraft 游戏本身就是客户端。

客户端需要使用 `启动器` 启动。有关启动器,可以参考[基础知识](https://crashmc.com/basis.html)
客户端需要使用 `启动器` 启动。有关启动器,可以参考[基础知识](/basis.html)

:::tip
如果您对 Minecraft 有较详细的理解,那么您不必完整阅读。
Expand Down
10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"main": "index.js",
"type": "module",
"devDependencies": {
"@andatoshiki/vitepress-plugin-nprogress": "^0.0.1",
"@giscus/vue": "^2.3.0",
"@typescript-eslint/eslint-plugin": "^6.4.0",
"@vite-pwa/vitepress": "^0.2.0",
Expand All @@ -20,10 +21,10 @@
"eslint-plugin-prettier-vue": "^4.2.0",
"eslint-plugin-vue": "^9.17.0",
"prettier": "^3.0.2",
"sass": "^1.68.0",
"tslib": "^2.6.1",
"vite-plugin-pwa": "^0.16.4",
"vitepress": "1.0.0-rc.4",
"vitepress-plugin-comment-with-giscus": "^1.1.7",
"vue": "^3.3.4",
"vue-eslint-parser": "^9.3.1",
"workbox-window": "^7.0.0"
Expand All @@ -42,6 +43,11 @@
"directory-tree": "^3.5.1",
"jszip": "^3.10.1",
"pako": "^2.1.0",
"typescript": "^5.1.6"
"typescript": "^5.1.6",
"viewerjs": "^1.11.6",
"vitepress-plugin-back-to-top": "^1.0.1",
"vitepress-plugin-codeblocks-fold": "^1.2.27",
"vitepress-plugin-comment-with-giscus": "^1.1.7",
"vitepress-plugin-image-viewer": "^1.1.2"
}
}

0 comments on commit a72360b

Please sign in to comment.