2021-05-03 12:57:54 +08:00
|
|
|
|
import { defineUserConfig } from "@vuepress/cli";
|
|
|
|
|
import type { DefaultThemeOptions } from "@vuepress/theme-default";
|
2021-04-07 23:09:52 +08:00
|
|
|
|
import * as sidebar from "./config/sidebar";
|
|
|
|
|
import * as navbar from "./config/navbar";
|
2021-04-06 23:47:32 +08:00
|
|
|
|
import * as path from "path";
|
|
|
|
|
|
2021-05-03 12:57:54 +08:00
|
|
|
|
const isProduction = process.env.NODE_ENV === "production";
|
2021-09-15 18:28:06 +08:00
|
|
|
|
const forMainRepo = process.env.XRAY_DOCS_MAIN_REPO === "true";
|
|
|
|
|
const useVite = process.env.XRAY_DOCS_USE_VITE === "true";
|
|
|
|
|
|
|
|
|
|
console.log("base:", forMainRepo ? "/" : "/Xray-docs-next/");
|
|
|
|
|
console.log(
|
|
|
|
|
"bundler:",
|
|
|
|
|
isProduction && !useVite ? "@vuepress/webpack" : "@vuepress/vite"
|
|
|
|
|
);
|
2021-05-03 12:57:54 +08:00
|
|
|
|
|
2021-04-06 23:47:32 +08:00
|
|
|
|
export default defineUserConfig<DefaultThemeOptions>({
|
|
|
|
|
theme: path.join(__dirname, "./theme"),
|
2021-05-03 12:57:54 +08:00
|
|
|
|
plugins: [
|
|
|
|
|
[
|
|
|
|
|
"@vuepress/plugin-search",
|
|
|
|
|
{
|
|
|
|
|
locales: {
|
|
|
|
|
"/": {
|
|
|
|
|
placeholder: "搜索",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
["@vuepress/plugin-debug", !isProduction],
|
|
|
|
|
],
|
2021-09-15 18:28:06 +08:00
|
|
|
|
base: forMainRepo ? "/" : "/Xray-docs-next/",
|
2021-04-06 23:47:32 +08:00
|
|
|
|
locales: {
|
|
|
|
|
"/": {
|
|
|
|
|
lang: "zh-CN",
|
|
|
|
|
title: "Project X",
|
|
|
|
|
description: "Xray 官方文档",
|
|
|
|
|
},
|
2021-05-26 20:25:44 +08:00
|
|
|
|
"/en/": {
|
2021-05-26 19:05:53 +08:00
|
|
|
|
lang: "en-US",
|
|
|
|
|
title: "Project X",
|
|
|
|
|
description: "Official document of Xray",
|
2021-05-26 19:32:52 +08:00
|
|
|
|
},
|
2021-04-06 23:47:32 +08:00
|
|
|
|
},
|
|
|
|
|
themeConfig: {
|
|
|
|
|
smoothScroll: true,
|
|
|
|
|
repo: "xtls/xray-core",
|
|
|
|
|
docsRepo: "xtls/Xray-docs-next",
|
|
|
|
|
docsDir: "docs",
|
|
|
|
|
docsBranch: "main",
|
|
|
|
|
editLinks: true,
|
|
|
|
|
enableToggle: true,
|
2021-04-07 23:09:52 +08:00
|
|
|
|
|
2021-04-06 23:47:32 +08:00
|
|
|
|
themePlugins: {
|
2021-05-03 12:57:54 +08:00
|
|
|
|
git: isProduction,
|
2021-04-06 23:47:32 +08:00
|
|
|
|
},
|
2021-04-07 22:20:50 +08:00
|
|
|
|
locales: {
|
|
|
|
|
"/": {
|
2021-04-07 23:09:52 +08:00
|
|
|
|
repoLabel: "查看源码",
|
|
|
|
|
editLinkText: "帮助我们改善此页面!",
|
2021-05-06 19:27:01 +08:00
|
|
|
|
tip: "提示",
|
|
|
|
|
warning: "注意",
|
|
|
|
|
danger: "警告",
|
2021-05-26 19:05:53 +08:00
|
|
|
|
lastUpdatedText: "最近更改",
|
|
|
|
|
selectLanguageName: "简体中文",
|
|
|
|
|
selectLanguageText: "多语言",
|
|
|
|
|
selectLanguageAriaLabel: "多语言",
|
2021-04-07 23:09:52 +08:00
|
|
|
|
sidebar: {
|
|
|
|
|
"/config/": sidebar.getConfigSidebar(
|
|
|
|
|
"特性详解",
|
|
|
|
|
"基础配置",
|
|
|
|
|
"入站代理",
|
|
|
|
|
"出站代理",
|
|
|
|
|
"底层传输",
|
|
|
|
|
"/config/"
|
|
|
|
|
),
|
2021-09-17 19:42:31 +08:00
|
|
|
|
"/document/": sidebar.getDocumentSidebar(
|
|
|
|
|
"快速入门文档",
|
|
|
|
|
"/document/"
|
|
|
|
|
),
|
2021-04-07 23:09:52 +08:00
|
|
|
|
"/document/level-0/": sidebar.getDocumentLv0Sidebar(
|
|
|
|
|
"小小白白话文",
|
|
|
|
|
"/document/level-0/"
|
|
|
|
|
),
|
|
|
|
|
"/document/level-1/": sidebar.getDocumentLv1Sidebar(
|
|
|
|
|
"入门技巧",
|
|
|
|
|
"/document/level-1/"
|
|
|
|
|
),
|
|
|
|
|
"/document/level-2/": sidebar.getDocumentLv2Sidebar(
|
|
|
|
|
"进阶技巧",
|
|
|
|
|
"/document/level-2/"
|
|
|
|
|
),
|
2021-04-11 12:36:45 +08:00
|
|
|
|
"/development/": sidebar.getDevelopmentSidebar(
|
|
|
|
|
"开发指南",
|
|
|
|
|
"协议详解",
|
|
|
|
|
"/development/"
|
|
|
|
|
),
|
2021-04-07 23:09:52 +08:00
|
|
|
|
},
|
|
|
|
|
navbar: navbar.hans,
|
2021-04-07 22:20:50 +08:00
|
|
|
|
},
|
2021-05-26 20:25:44 +08:00
|
|
|
|
"/en/": {
|
2021-05-26 19:05:53 +08:00
|
|
|
|
repoLabel: "Source",
|
2023-04-01 08:20:39 -07:00
|
|
|
|
editLinkText: "Help us improve this page on GitHub!",
|
|
|
|
|
tip: "Tip",
|
|
|
|
|
warning: "Warning",
|
|
|
|
|
danger: "Danger",
|
|
|
|
|
lastUpdatedText: "Last Updated",
|
2021-05-26 19:32:52 +08:00
|
|
|
|
selectLanguageName: "English (WIP)",
|
2021-05-26 19:05:53 +08:00
|
|
|
|
// TODO: translation
|
|
|
|
|
sidebar: {
|
|
|
|
|
"/en/config/": sidebar.getConfigSidebar(
|
2023-04-01 08:20:39 -07:00
|
|
|
|
"Xray Features",
|
|
|
|
|
"Config Reference",
|
|
|
|
|
"Inbound Protocol",
|
|
|
|
|
"Outbound Protocol",
|
|
|
|
|
"Stream Transport Protocol",
|
2021-05-26 19:05:53 +08:00
|
|
|
|
"/en/config/"
|
|
|
|
|
),
|
|
|
|
|
"/en/document/level-0/": sidebar.getDocumentLv0Sidebar(
|
2023-04-01 08:20:39 -07:00
|
|
|
|
"Beginner Tutorial",
|
2021-05-26 19:05:53 +08:00
|
|
|
|
"/en/document/level-0/"
|
|
|
|
|
),
|
|
|
|
|
"/en/document/level-1/": sidebar.getDocumentLv1Sidebar(
|
2023-04-01 08:20:39 -07:00
|
|
|
|
"Getting Started Tips",
|
2021-05-26 19:05:53 +08:00
|
|
|
|
"/en/document/level-1/"
|
|
|
|
|
),
|
|
|
|
|
"/en/document/level-2/": sidebar.getDocumentLv2Sidebar(
|
2023-04-01 08:20:39 -07:00
|
|
|
|
"Advanced Documentation",
|
2021-05-26 19:05:53 +08:00
|
|
|
|
"/en/document/level-2/"
|
|
|
|
|
),
|
|
|
|
|
"/en/development/": sidebar.getDevelopmentSidebar(
|
2023-04-01 08:20:39 -07:00
|
|
|
|
"Developer Guide",
|
|
|
|
|
"Protocol Details",
|
2021-05-26 19:05:53 +08:00
|
|
|
|
"/en/development/"
|
|
|
|
|
),
|
|
|
|
|
},
|
|
|
|
|
navbar: navbar.en,
|
|
|
|
|
},
|
2021-04-07 22:20:50 +08:00
|
|
|
|
},
|
2021-04-06 23:47:32 +08:00
|
|
|
|
},
|
2021-04-11 12:37:45 +08:00
|
|
|
|
head: [["link", { rel: "icon", href: `/logo.png` }]],
|
2021-04-06 23:47:32 +08:00
|
|
|
|
markdown: {
|
|
|
|
|
toc: {
|
|
|
|
|
level: [2],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
extendsMarkdown: (md) => {
|
|
|
|
|
md.use(require("markdown-it-footnote"));
|
|
|
|
|
},
|
2021-09-15 18:28:06 +08:00
|
|
|
|
bundler: isProduction && !useVite ? "@vuepress/webpack" : "@vuepress/vite",
|
2021-04-06 23:47:32 +08:00
|
|
|
|
});
|