Jelajahi Sumber

【维护】升级 Mermaid.js 并优化相关功能

- 将 Mermaid.js 版本从 8.14.0 升级到 11.5.0
- 更新 Mermaid.js 的 CDN 链接
- 在初始化 Mermaid 时添加 await 关键字,确保异步操作正确执行
PJ568 1 tahun lalu
induk
melakukan
72fb570def
7 mengubah file dengan 6 tambahan dan 31 penghapusan
  1. 1 1
      CONTRIBUTING.md
  2. 1 1
      README.md
  3. 1 1
      README_EN.md
  4. 3 3
      index.html
  5. 0 0
      index.min.html
  6. 0 24
      scripts/python/gen_min_html.py
  7. 0 1
      scripts/python/requirements.txt

+ 1 - 1
CONTRIBUTING.md

@@ -21,7 +21,7 @@
 1. Fork 源码,下载到本地并运行项目;
 2. 添加或修改代码;
 3. 对相关改动进行全面的自我测试;
-4. 运行 `cargo run -- index.html index.min.html` 命令以生成压缩的最小文件;
+4. 运行 `cargo run --release -- index.html index.min.html` 命令以生成压缩的最小文件;
 5. 确认无误后提交修改到 Github;
 6. 提交 Pull Request。
 

+ 1 - 1
README.md

@@ -24,7 +24,7 @@
 
 ```yaml
 - name: Deploy markdown.html
-  uses: PJ-568/[email protected].0
+  uses: PJ-568/[email protected].1
   with:
     target-dir: '.'
 ```

+ 1 - 1
README_EN.md

@@ -24,7 +24,7 @@ This project aims to provide a low-dependency, simple deployment solution for re
 
 ```yaml
 - name: Deploy markdown.html
-  uses: PJ-568/[email protected].0
+  uses: PJ-568/[email protected].1
   with:
     target-dir: '.'
 ```

+ 3 - 3
index.html

@@ -1,7 +1,7 @@
 <!doctype html>
 
 <html>
-<markdown-html version="1.9.0" author="PJ568" repo="https://github.com/PJ-568/markdown.html"
+<markdown-html version="1.9.1" author="PJ568" repo="https://github.com/PJ-568/markdown.html"
   license="CC BY-SA 4.0 International"></markdown-html>
 
 <head>
@@ -14,7 +14,7 @@
   <script src="https://lib.baomitu.com/pjax/0.2.8/pjax.min.js" type="text/javascript"></script>
   <script src="https://lib.baomitu.com/translate.js/3.7.2/translate.js" type="text/javascript"></script>
   <script src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-y/Darkmode.js/1.5.7/darkmode-js.min.js" type="text/javascript"></script>
-  <script src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-y/mermaid/8.14.0/mermaid.min.js" type="text/javascript"></script>
+  <script src="https://cdnjs.cloudflare.com/ajax/libs/mermaid/11.5.0/mermaid.min.js" type="text/javascript"></script>
   <script>
     // 使用 IIFE 包裹以避免全局变量污染
     (function () {
@@ -574,7 +574,7 @@
       async function showMarkdownEnded() {
         refreshTranslate();
         infoTranslate();	//// 检查并提示翻译
-        mermaid.init({ noteMargin: 10 }, '.language-mermaid');	//// 初始化 mermaid
+        await mermaid.init({ noteMargin: 10 }, '.language-mermaid');	//// 初始化 mermaid
         translate.execute();	//// 手动触发翻译,但是理论上 translate-js 会监听页面变化
         endLoad();
         window.scrollTo({

File diff ditekan karena terlalu besar
+ 0 - 0
index.min.html


+ 0 - 24
scripts/python/gen_min_html.py

@@ -1,24 +0,0 @@
-from htmlmin import minify
-import sys
-
-def conpress(file_path, target_path):
-    # 读取 HTML 文件
-    with open(file_path, 'r', encoding='utf-8') as f:
-        # 写入压缩后的 HTML 文件
-        with open(target_path, 'w', encoding='utf-8') as t:
-            t.write(minify(f.read(), remove_comments=True, remove_empty_space=True))
-
-if __name__ == "__main__":
-    """
-    压缩指定的 HTML 文件。
-
-    :param path/to/file: 欲读取的源文件路径
-    :param path/to/file: 欲写入的目标文件路径
-    """
-    if len(sys.argv) != 3:
-        print("使用方法:python gen_min_html.py <源文件路径> <目标文件路径>")
-        sys.exit(1)
-    
-    file_path = sys.argv[1]
-    target_path = sys.argv[2]
-    conpress(file_path, target_path)

+ 0 - 1
scripts/python/requirements.txt

@@ -1 +0,0 @@
-htmlmin==0.1.12

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini