update dependences
parent
362754555b
commit
abfeb40477
|
@ -1,8 +1,13 @@
|
|||
import { defineUserConfig } from "@vuepress/cli";
|
||||
import type { DefaultThemeOptions } from "@vuepress/theme-default";
|
||||
import * as sidebar from "./config/sidebar";
|
||||
import { viteBundler } from "@vuepress/bundler-vite";
|
||||
import { webpackBundler } from "@vuepress/bundler-webpack";
|
||||
import { UserConfig, defineUserConfig } from "@vuepress/cli";
|
||||
import { searchPlugin } from "@vuepress/plugin-search";
|
||||
import markdownItFootnote from "markdown-it-footnote";
|
||||
import { defaultTheme } from "vuepress";
|
||||
import * as navbar from "./config/navbar";
|
||||
import * as path from "path";
|
||||
import { MermaidPlugin } from "./config/plugins/mermaidPlugin";
|
||||
import * as sidebar from "./config/sidebar";
|
||||
import { docsPlugin } from "./theme/index";
|
||||
|
||||
const isProduction = process.env.NODE_ENV === "production";
|
||||
const forMainRepo = process.env.XRAY_DOCS_MAIN_REPO === "true";
|
||||
|
@ -14,20 +19,15 @@ console.log(
|
|||
isProduction && !useVite ? "@vuepress/webpack" : "@vuepress/vite"
|
||||
);
|
||||
|
||||
export default defineUserConfig<DefaultThemeOptions>({
|
||||
theme: path.join(__dirname, "./theme"),
|
||||
export default defineUserConfig(<UserConfig>{
|
||||
plugins: [
|
||||
[
|
||||
"@vuepress/plugin-search",
|
||||
{
|
||||
locales: {
|
||||
"/": {
|
||||
placeholder: "搜索",
|
||||
},
|
||||
searchPlugin({
|
||||
locales: {
|
||||
"/": {
|
||||
placeholder: "搜索",
|
||||
},
|
||||
},
|
||||
],
|
||||
["@vuepress/plugin-debug", !isProduction],
|
||||
}),
|
||||
],
|
||||
base: forMainRepo ? "/" : "/Xray-docs-next/",
|
||||
locales: {
|
||||
|
@ -42,7 +42,8 @@ export default defineUserConfig<DefaultThemeOptions>({
|
|||
description: "Official document of Xray",
|
||||
},
|
||||
},
|
||||
themeConfig: {
|
||||
theme: defaultTheme({
|
||||
...docsPlugin,
|
||||
smoothScroll: true,
|
||||
repo: "xtls/xray-core",
|
||||
docsRepo: "xtls/Xray-docs-next",
|
||||
|
@ -56,6 +57,7 @@ export default defineUserConfig<DefaultThemeOptions>({
|
|||
},
|
||||
locales: {
|
||||
"/": {
|
||||
navbar: navbar.hans,
|
||||
repoLabel: "查看源码",
|
||||
editLinkText: "帮助我们改善此页面!",
|
||||
tip: "提示",
|
||||
|
@ -72,31 +74,30 @@ export default defineUserConfig<DefaultThemeOptions>({
|
|||
"入站代理",
|
||||
"出站代理",
|
||||
"底层传输",
|
||||
"/config/"
|
||||
"/config/",
|
||||
),
|
||||
"/document/": sidebar.getDocumentSidebar(
|
||||
"快速入门文档",
|
||||
"/document/"
|
||||
"/document/",
|
||||
),
|
||||
"/document/level-0/": sidebar.getDocumentLv0Sidebar(
|
||||
"小小白白话文",
|
||||
"/document/level-0/"
|
||||
"/document/level-0/",
|
||||
),
|
||||
"/document/level-1/": sidebar.getDocumentLv1Sidebar(
|
||||
"入门技巧",
|
||||
"/document/level-1/"
|
||||
"/document/level-1/",
|
||||
),
|
||||
"/document/level-2/": sidebar.getDocumentLv2Sidebar(
|
||||
"进阶技巧",
|
||||
"/document/level-2/"
|
||||
"/document/level-2/",
|
||||
),
|
||||
"/development/": sidebar.getDevelopmentSidebar(
|
||||
"开发指南",
|
||||
"协议详解",
|
||||
"/development/"
|
||||
"/development/",
|
||||
),
|
||||
},
|
||||
navbar: navbar.hans,
|
||||
},
|
||||
"/en/": {
|
||||
repoLabel: "Source",
|
||||
|
@ -114,30 +115,30 @@ export default defineUserConfig<DefaultThemeOptions>({
|
|||
"Inbound Protocol",
|
||||
"Outbound Protocol",
|
||||
"Stream Transport Protocol",
|
||||
"/en/config/"
|
||||
"/en/config/",
|
||||
),
|
||||
"/en/document/level-0/": sidebar.getDocumentLv0Sidebar(
|
||||
"Beginner Tutorial",
|
||||
"/en/document/level-0/"
|
||||
"/en/document/level-0/",
|
||||
),
|
||||
"/en/document/level-1/": sidebar.getDocumentLv1Sidebar(
|
||||
"Getting Started Tips",
|
||||
"/en/document/level-1/"
|
||||
"/en/document/level-1/",
|
||||
),
|
||||
"/en/document/level-2/": sidebar.getDocumentLv2Sidebar(
|
||||
"Advanced Documentation",
|
||||
"/en/document/level-2/"
|
||||
"/en/document/level-2/",
|
||||
),
|
||||
"/en/development/": sidebar.getDevelopmentSidebar(
|
||||
"Developer Guide",
|
||||
"Protocol Details",
|
||||
"/en/development/"
|
||||
"/en/development/",
|
||||
),
|
||||
},
|
||||
navbar: navbar.en,
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
head: [["link", { rel: "icon", href: `/logo.png` }]],
|
||||
markdown: {
|
||||
toc: {
|
||||
|
@ -145,7 +146,9 @@ export default defineUserConfig<DefaultThemeOptions>({
|
|||
},
|
||||
},
|
||||
extendsMarkdown: (md) => {
|
||||
md.use(require("markdown-it-footnote"));
|
||||
md.use(markdownItFootnote);
|
||||
md.use(MermaidPlugin);
|
||||
},
|
||||
bundler: isProduction && !useVite ? "@vuepress/webpack" : "@vuepress/vite",
|
||||
bundler:
|
||||
process.env.DOCS_BUNDLER === "webpack" ? webpackBundler() : viteBundler(),
|
||||
});
|
||||
|
|
5
docs/.vuepress/theme/plugin/mermaidPlugin.ts → docs/.vuepress/config/plugins/mermaidPlugin.ts
Normal file → Executable file
5
docs/.vuepress/theme/plugin/mermaidPlugin.ts → docs/.vuepress/config/plugins/mermaidPlugin.ts
Normal file → Executable file
|
@ -1,9 +1,8 @@
|
|||
// Reference: https://github.com/mermaid-js/mermaid
|
||||
|
||||
import { PluginSimple } from "markdown-it/lib";
|
||||
import { hash } from "@vuepress/utils";
|
||||
|
||||
const MermaidPlugin: PluginSimple = function (md) {
|
||||
const MermaidPlugin = function (md) {
|
||||
const fence = md.renderer.rules.fence;
|
||||
md.renderer.rules.fence = (...args) => {
|
||||
const [tokens, idx] = args;
|
||||
|
@ -13,7 +12,7 @@ const MermaidPlugin: PluginSimple = function (md) {
|
|||
const key = `mermaid_${hash(idx)}`;
|
||||
let { content } = token;
|
||||
return `<Mermaid identifier="${key}" graph="${encodeURI(
|
||||
content
|
||||
content,
|
||||
)}"></Mermaid>`;
|
||||
}
|
||||
const rawCode = fence(...args);
|
|
@ -1,16 +1,14 @@
|
|||
import { path } from "@vuepress/utils";
|
||||
import { Theme } from "@vuepress/core";
|
||||
import { MermaidPlugin } from "./plugin/mermaidPlugin";
|
||||
import { path } from "@vuepress/utils";
|
||||
import { defaultTheme } from "vuepress";
|
||||
|
||||
export const docsPlugin: Theme = (options, app) => {
|
||||
return {
|
||||
return defaultTheme({
|
||||
name: "xray-docs-theme",
|
||||
extends: "@vuepress/theme-default",
|
||||
clientAppEnhanceFiles: path.resolve(__dirname, "clientAppEnhance.ts"),
|
||||
extendsMarkdown: (md) => {
|
||||
md.use(MermaidPlugin);
|
||||
},
|
||||
};
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
export default docsPlugin;
|
||||
|
|
31
package.json
31
package.json
|
@ -10,19 +10,22 @@
|
|||
"@types/jquery": "^3.5.14",
|
||||
"@types/mermaid": "^9.2.0",
|
||||
"@types/node": "^20.11.0",
|
||||
"@vuepress/bundler-vite": "^2.0.0-beta.25",
|
||||
"@vuepress/plugin-back-to-top": "^2.0.0-beta.25",
|
||||
"@vuepress/plugin-debug": "^2.0.0-beta.25",
|
||||
"@vuepress/plugin-search": "^2.0.0-beta.25",
|
||||
"@vuepress/bundler-vite": "^2.0.0-rc.0",
|
||||
"@vuepress/bundler-webpack": "2.0.0-rc.0",
|
||||
"@vuepress/plugin-back-to-top": "^2.0.0-rc.0",
|
||||
"@vuepress/plugin-debug": "^2.0.0-beta.33",
|
||||
"@vuepress/plugin-search": "^2.0.0-rc.0",
|
||||
"typescript": "^5.2.2",
|
||||
"postcss-loader": "^8.0.0",
|
||||
"prettier": "^3.2.2",
|
||||
"sass": "^1.51.0",
|
||||
"sass-loader": "^14.0.0",
|
||||
"sass-loader": "^13.3.2",
|
||||
"vue-property-decorator": "^9.1.2",
|
||||
"vuepress": "^2.0.0-beta.25"
|
||||
"vuepress": "^2.0.0-rc.0"
|
||||
},
|
||||
"packageManager": "pnpm@8.10.5",
|
||||
"scripts": {
|
||||
"docs:dev": "vuepress dev docs --clean-temp --clean-cache --host 127.0.0.1",
|
||||
"docs:dev": "vuepress dev docs",
|
||||
"docs:build": "vuepress build docs",
|
||||
"lint": "prettier --write ."
|
||||
},
|
||||
|
@ -33,6 +36,16 @@
|
|||
"jquery": "^3.6.0",
|
||||
"markdown-it-footnote": "^4.0.0",
|
||||
"mermaid": "^10.7.0",
|
||||
"vuepress-plugin-mermaidjs": "^2.0.0-beta.2"
|
||||
"vuepress-plugin-mermaidjs": "^2.0.0-beta.2",
|
||||
"@vuepress/cli": "2.0.0-rc.0",
|
||||
"@vuepress/client": "2.0.0-rc.0",
|
||||
"@vuepress/core": "2.0.0-rc.0",
|
||||
"@vuepress/plugin-google-analytics": "2.0.0-rc.0",
|
||||
"@vuepress/plugin-register-components": "2.0.0-rc.0",
|
||||
"@vuepress/plugin-shiki": "2.0.0-rc.0",
|
||||
"@vuepress/theme-default": "2.0.0-rc.0",
|
||||
"@vuepress/utils": "2.0.0-rc.0",
|
||||
"anywhere": "^1.6.0",
|
||||
"vue": "^3.4.15"
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue