diff --git a/deploy/nginx/nginx.conf b/deploy/nginx/nginx.conf
index 224f56ff7a813d926ed1526bf86506586202d99a..e66929d36628c201692618b94e6a1629111b143e 100644
--- a/deploy/nginx/nginx.conf
+++ b/deploy/nginx/nginx.conf
@@ -101,6 +101,16 @@ http {
index index.html;
}
+ location ^~ /zh/docs/24.03_LTS_SP1/ {
+ proxy_set_header X-Forwarded-For $http_x_real_ip;
+ proxy_http_version 1.1;
+ proxy_set_header Connection "";
+ proxy_ssl_protocols TLSv1.3;
+ proxy_ssl_verify off;
+
+ proxy_pass https://openeuler-website-docs-zh.openeuler-website-docs:8080/zh/docs/24.03_LTS_SP1/;
+ }
+
include ./confd/nginx*.conf;
error_page 401 402 403 405 406 407 413 414 /error.html;
@@ -118,28 +128,5 @@ http {
location = /zh/ {
return 301 /zh/index.html;
}
-
- # location ^~ /zh/docs/22.03/ {
- # proxy_set_header X-Forwarded-For $http_x_real_ip;
- # proxy_http_version 1.1;
- # proxy_set_header Connection "";
- # proxy_ssl_protocols TLSv1.3;
- # proxy_ssl_verify off;
- # # 转发后移除前缀
- # rewrite ^/zh/docs/22.03(/.*)$ $1 break;
- # proxy_pass http://openeuler-docs-website-stable-2203.openeuler-website-docs:8080;
- # }
-
- # location ^~ /zh/docs/23.03/ {
- # proxy_set_header X-Forwarded-For $http_x_real_ip;
- # proxy_http_version 1.1;
- # proxy_set_header Connection "";
- # proxy_ssl_protocols TLSv1.3;
- # proxy_ssl_verify off;
- # # 转发后移除前缀
- # rewrite ^/zh/docs/23.03(/.*)$ $1 break;
- # proxy_pass http://openeuler-docs-website-stable-2303.openeuler-website-docs:8080;
- # }
-
}
}
\ No newline at end of file
diff --git a/docs/.vitepress/src/components/DocBreadCrumb.vue b/docs/.vitepress/src/components/DocBreadCrumb.vue
index 05ee2d9fae2b2a3c217cc1d715ad669b0fbaa2c9..97081b655370c0da650e7f48700ac04012af158c 100644
--- a/docs/.vitepress/src/components/DocBreadCrumb.vue
+++ b/docs/.vitepress/src/components/DocBreadCrumb.vue
@@ -100,5 +100,11 @@ const goToPage = (href: string) => {
@include respond-to('<=laptop') {
height: 18px;
}
+
+ .o-breadcrumb {
+ --breadcrumb-color-hover: var(--o-color-primary1);
+ --breadcrumb-color-active: var(--o-color-primary1);
+ --breadcrumb-color-selected: var(--o-color-primary1);
+ }
}
diff --git a/docs/.vitepress/src/layouts/LayoutDoc.vue b/docs/.vitepress/src/layouts/LayoutDoc.vue
index 8e62a7f99bad616d955c0aa2b8326e755be52728..2438ef0687e515e8bcff7bf753d5b0bfd5633991 100644
--- a/docs/.vitepress/src/layouts/LayoutDoc.vue
+++ b/docs/.vitepress/src/layouts/LayoutDoc.vue
@@ -378,11 +378,12 @@ onUnmounted(() => {
-
+
{{ item.version }}
diff --git a/scripts/build.js b/scripts/build.js
index 5b35d31cbd4e5f5364748a6184a5fee3e0ebae43..5f3d7fdc23615dd9e1390e8c1a0cdba8f9407b65 100644
--- a/scripts/build.js
+++ b/scripts/build.js
@@ -4,7 +4,7 @@ import matter from 'gray-matter';
import markdownIt from 'markdown-it';
import markdownItAnchor from 'markdown-it-anchor';
import { slugify } from '@mdit-vue/shared';
-import simpleGit from 'simple-git';
+//import simpleGit from 'simple-git';
const __dirname = path.resolve(); // 获取当前文件夹路径
const processedFiles = new Set(); // 记录已处理过的文件路径
@@ -14,7 +14,7 @@ const errors = [];
/**
* git clone
*/
-export async function gitClone(options) {
+/* export async function gitClone(options) {
const tempDir = path.join(__dirname, 'temp');
fs.removeSync(tempDir);
fs.ensureDirSync(tempDir);
@@ -28,7 +28,7 @@ export async function gitClone(options) {
} finally {
fs.removeSync(tempDir);
}
-}
+} */
/**
* 去除一些 md 符号,只保留文本
@@ -304,10 +304,12 @@ async function processMenuFile() {
const outputPath = path.join(__dirname, './docs/.vitepress/public/menu/menu.json');
const updatedContent = await mergeReferences(menuFilePath);
- fs.outputFileSync(outputPath, JSON.stringify(updatedContent.children, null, 2));
if (errors.length > 0) {
console.table(errors);
+ throw new Error('构建失败~请查看表格输出原因');
}
+
+ fs.outputFileSync(outputPath, JSON.stringify(updatedContent.children, null, 2));
}
// 执行处理
diff --git a/scripts/pre-build-check.js b/scripts/pre-build-check.js
index c6da9a71c1abcec817a71a1daad3522df0b787c4..a401412b82fa891712cc199799e29b0c6ed5e2f6 100644
--- a/scripts/pre-build-check.js
+++ b/scripts/pre-build-check.js
@@ -2,6 +2,29 @@ import fs from 'fs-extra';
import path from 'path';
import { spawn, execSync } from 'child_process';
+const config = `
+export default {
+ markdown: {
+ config: (md) => {
+ md.renderer.rules.code_inline = (tokens, idx) => {
+ const content = tokens[idx].content;
+ const escapedContent = md.utils.escapeHtml(content);
+ return \`\${escapedContent}
\`;
+ };
+
+ md.renderer.rules.text = (tokens, idx) => {
+ const content = tokens[idx].content;
+ const escapedContent = md.utils.escapeHtml(content);
+ if (/{{(.*?)}}/g.test(content)) {
+ return \`\${escapedContent}\`;
+ }
+ return escapedContent;
+ };
+ },
+ },
+};
+`;
+
/**
* 获取最近一次提交的变更文件(排除被删除的文件)
* @returns {string[]} 变更文件路径数组
@@ -61,15 +84,25 @@ function copy(filePath) {
* @param {number} tryCount 重试次数
*/
function build() {
+ // 创建临时 docs
+ fs.ensureDirSync('temp-docs');
+
+ // 输出临时配置
+ if (!fs.existsSync('temp-docs/docs/config.js')) {
+ fs.outputFileSync('temp-docs/docs/config.js', config);
+ }
+
+ // 执行 pnpm vitepress build temp-docs
const errors = [];
- const ps = spawn('pnpm', ['vitepress', 'build', 'temp-docs'], { shell: true });
+ const ps = spawn('pnpm', ['vitepress', 'build', 'temp-docs'], {
+ shell: true,
+ });
ps.stderr.on('data', (data) => {
const match = String(data).match(/Error: \[plugin vite:vue\] (.*?) \((\d+):(\d+)\): (.*?)\n/);
if (match && match.length >= 5) {
errors.push({
file: match[1].replace('temp-docs', 'docs'),
- line: match[2],
error: match[4],
});
}
@@ -82,25 +115,21 @@ function build() {
fs.removeSync('docs/.vitepress/dist');
if (errors.length > 0) {
console.table(errors);
+ throw new Error('构建失败~请查看表格输出原因');
}
});
}
-
function main() {
- // 创建临时 docs
- fs.ensureDirSync('temp-docs');
-
- // 获取变更文件复制到临时目录
const changedFiles = getRecentGitChangesSync().filter((item) => item.endsWith('.md') && !item.endsWith('_menu.md'));
- console.log('build docs markdown files: ');
- console.log(changedFiles.join('\n'));
- changedFiles.forEach((item) => {
- copy(item);
- });
-
- // 构建
- build();
+ if (changedFiles.length > 0) {
+ console.log('build docs markdown files: ');
+ console.log(changedFiles.join('\n'));
+ changedFiles.forEach((item) => {
+ copy(item);
+ });
+ build();
+ }
}
-main();
\ No newline at end of file
+main();