From 390bc2a1b3be69257a04b2be3aac81d46b12d788 Mon Sep 17 00:00:00 2001
From: neveler <55753029+neveler@users.noreply.github.com>
Date: Fri, 7 Nov 2025 18:26:28 +0800
Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E8=87=AA=E5=8A=A8=E8=BD=AC?=
=?UTF-8?q?=E6=8D=A2=E7=9B=B8=E5=AF=B9=E9=93=BE=E6=8E=A5=20(#324)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
_docs/404.md => 404.md | 16 ++++++------
Gemfile | 4 +++
_docs/contribution.md | 2 +-
_docs/faq.md | 6 ++---
_docs/groups.md | 2 +-
_docs/help.md | 2 +-
_launcher/auto-installing.md | 2 +-
_launcher/fabric_and_optifine_install.md | 2 +-
_launcher/shader.md | 2 +-
_modpack/error-handbook.md | 2 +-
_modpack/serverpack3.md | 2 +-
_plugins/auto-link.rb | 31 ++++++++++++++++++++++++
12 files changed, 54 insertions(+), 19 deletions(-)
rename _docs/404.md => 404.md (93%)
create mode 100644 _plugins/auto-link.rb
diff --git a/_docs/404.md b/404.md
similarity index 93%
rename from _docs/404.md
rename to 404.md
index a3a3fdd..b660839 100644
--- a/_docs/404.md
+++ b/404.md
@@ -1,8 +1,8 @@
----
-layout: splash
----
-
-
+---
+layout: splash
+---
+
+
diff --git a/Gemfile b/Gemfile
index d7ce736..3ba85cf 100644
--- a/Gemfile
+++ b/Gemfile
@@ -30,3 +30,7 @@ end
gem "wdm", "0.2.0", :platforms => [:windows]
gem "http_parser.rb", "0.8.0", :platforms => [:jruby]
+
+# plugin dependencies
+gem "nokogiri", "1.18.10"
+gem "addressable", "2.8.7"
diff --git a/_docs/contribution.md b/_docs/contribution.md
index 1bb0c7d..4504332 100644
--- a/_docs/contribution.md
+++ b/_docs/contribution.md
@@ -6,4 +6,4 @@ author: huanghongxun
如果你认为你有能力为 HMCL 添加高质量的帮助文档,或希望修改错误,你可以到 [https://github.com/HMCL-dev/HMCL-docs](https://github.com/HMCL-dev/HMCL-docs) 仓库中发 Pull Request,或者提 Issue。
-或者你可以进入我们的 [Discord](https://discord.gg/jVvC7HfM6U) 或 [HMCL 用户群](/groups.html) 群以向 HMCL 反馈。
+或者你可以进入我们的 [Discord](https://discord.gg/jVvC7HfM6U) 或 [HMCL 用户群](/_docs/groups.md) 群以向 HMCL 反馈。
diff --git a/_docs/faq.md b/_docs/faq.md
index f1216eb..7835122 100644
--- a/_docs/faq.md
+++ b/_docs/faq.md
@@ -78,15 +78,15 @@ contributors:
- [CurseForge](https://www.curseforge.com/minecraft/search?class=mc-mods)
- [Modrinth](https://modrinth.com/mods)
-HMCL 自动安装与使用模组教程: [跳转](/launcher/auto-installing.html)
+HMCL 自动安装与使用模组教程: [跳转](/_launcher/auto-installing.md)
#### 安装模组后游戏报错怎么办
安装模组后游戏无法启动或崩溃是常见的情况,通常是模组冲突或缺少前置模组导致的。别担心,大部分问题都能轻松解决。
-在 HMCL《自动安装与模组下载简介》的末尾讲到了常用的解决方法: [跳转](/launcher/auto-installing.html#%E5%AE%89%E8%A3%85-mod-%E5%90%8E%E6%B8%B8%E6%88%8F%E6%8A%A5%E9%94%99%E6%97%A0%E6%B3%95%E5%90%AF%E5%8A%A8)
+在 HMCL《自动安装与模组下载简介》的末尾讲到了常用的解决方法: [跳转](/_launcher/auto-installing.md#安装-mod-后游戏报错无法启动)
-或者前往模组包报错排查手册中查看: [跳转](/modpack/error-handbook.html)
+或者前往模组包报错排查手册中查看: [跳转](/_modpack/error-handbook.md)
如果无法解决错误,尝试 [寻求帮助](help.html)
diff --git a/_docs/groups.md b/_docs/groups.md
index 4cb6443..5c483ac 100644
--- a/_docs/groups.md
+++ b/_docs/groups.md
@@ -31,7 +31,7 @@ contributors:
## 报错崩溃交流群
-如果你遇到了游戏非正常退出问题,欢迎加入报错崩溃交流群咨询解决方案:[Minecraft 报错崩溃交流群](/crash-support-group.html)
+如果你遇到了游戏非正常退出问题,欢迎加入报错崩溃交流群咨询解决方案:[Minecraft 报错崩溃交流群](/_docs/crash-support-group.md)
**本群仅处理游戏报错崩溃问题,无关话题请前往其他群聊讨论。**
diff --git a/_docs/help.md b/_docs/help.md
index efb3b4c..e3eea80 100644
--- a/_docs/help.md
+++ b/_docs/help.md
@@ -8,7 +8,7 @@ author: zkitefly
Hello Minecraft! Launcher 的官方 QQ 群聊。
-[点击前往](/groups.html)
+[点击前往](/_docs/groups.md)
## Discord 频道
diff --git a/_launcher/auto-installing.md b/_launcher/auto-installing.md
index d271928..0dc2650 100644
--- a/_launcher/auto-installing.md
+++ b/_launcher/auto-installing.md
@@ -68,7 +68,7 @@ HMCL 内置了 CurseForge 和 Modrinth 下载源的搜索和下载功能, 目前
#### OptiFine
-[详情请查阅此](/launcher/shader.html)
+[详情请查阅此](/_launcher/shader.md)
### 手动安装
diff --git a/_launcher/fabric_and_optifine_install.md b/_launcher/fabric_and_optifine_install.md
index c24aa8e..ce0a864 100644
--- a/_launcher/fabric_and_optifine_install.md
+++ b/_launcher/fabric_and_optifine_install.md
@@ -54,7 +54,7 @@ OptiFine [页面](https://optifine.net/downloads) 操作:
OptiFine 非官方 [中文页面](https://optifine.cn/downloads) 操作:
-
+
#### 安装
diff --git a/_launcher/shader.md b/_launcher/shader.md
index 73c2cff..9a51724 100644
--- a/_launcher/shader.md
+++ b/_launcher/shader.md
@@ -42,7 +42,7 @@ contributors:
### 方式四:OptiFine 与 Mod 加载器共存
-从[ OptiFine 官网](https://www.optifine.net/)上下载的 Jar 文件本身也可作为 Mod 被加载,可以用 Java 运行下载的文件并导出 Mod 版本。Mod 安装具体方法见 [ Mod 安装教程](auto-installing.html)
+从[ OptiFine 官网](https://www.optifine.net/)上下载的 Jar 文件本身也可作为 Mod 被加载,可以用 Java 运行下载的文件并导出 Mod 版本。Mod 安装具体方法见 [ Mod 安装教程](/_launcher/auto-installing.md)
注意:
diff --git a/_modpack/error-handbook.md b/_modpack/error-handbook.md
index f5ff01a..8e69680 100644
--- a/_modpack/error-handbook.md
+++ b/_modpack/error-handbook.md
@@ -41,7 +41,7 @@ author: LIPiston
...
```
-我们极力推荐您打开版本隔离,因为这样能避免模组之间的一部分冲突 [跳转](/launcher/global-version-isolation.html)
+我们极力推荐您打开版本隔离,因为这样能避免模组之间的一部分冲突 [跳转](/_launcher/isolation.md)
## 简单排查
diff --git a/_modpack/serverpack3.md b/_modpack/serverpack3.md
index 64ff9dc..5d6093f 100644
--- a/_modpack/serverpack3.md
+++ b/_modpack/serverpack3.md
@@ -4,7 +4,7 @@ date: 2023-01-11 14:13:45 +0800
author: buggzd
---
-> 阅读本文前,请先阅读[此文章](/modpack/serverpack.html)
+> 阅读本文前,请先阅读[此文章](/_modpack/serverpack.md)
# 前置知识
diff --git a/_plugins/auto-link.rb b/_plugins/auto-link.rb
new file mode 100644
index 0000000..8909b7d
--- /dev/null
+++ b/_plugins/auto-link.rb
@@ -0,0 +1,31 @@
+require "nokogiri"
+require "addressable/uri"
+
+Jekyll::Hooks.register [:pages, :documents], :post_convert do |doc|
+ next unless doc.output_ext == ".html"
+
+ site = doc.site
+ baseurl = site.config["baseurl"].to_s
+ liquid_context = Liquid::Context.new({}, {}, { site: site })
+
+ process_uri = lambda do |path|
+ uri = Addressable::URI.parse(path)
+ if uri&.path && !uri.path&.start_with?(baseurl)
+ uri.path = Liquid::Template.parse("{% link #{uri.path[1..]} %}").render!(liquid_context)
+ end
+ uri.to_s
+ end
+
+ fragment = Nokogiri::HTML::DocumentFragment.parse(doc.content)
+ fragment.css("[src^=\"/\"]").each do |item|
+ if item["src"]
+ item["src"] = process_uri.call(item["src"])
+ end
+ end
+ fragment.css("[href^=\"/\"]").each do |item|
+ if item["href"]
+ item["href"] = process_uri.call(item["href"])
+ end
+ end
+ doc.content = fragment.to_html
+end