From 6d7efbbf2835fbf786b0a6ede5ce8444cb001b43 Mon Sep 17 00:00:00 2001 From: Tunglies <77394545+Tunglies@users.noreply.github.com> Date: Thu, 30 Oct 2025 20:08:57 +0800 Subject: [PATCH] fix: reorder import statements and enhance normalizeDetailsTags function --- scripts/telegram.mjs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/scripts/telegram.mjs b/scripts/telegram.mjs index d7c741fc..f1240494 100644 --- a/scripts/telegram.mjs +++ b/scripts/telegram.mjs @@ -1,6 +1,6 @@ import axios from "axios"; import { readFileSync } from "fs"; -import { log_success, log_error, log_info } from "./utils.mjs"; +import { log_error, log_info, log_success } from "./utils.mjs"; const CHAT_ID_RELEASE = "@clash_verge_re"; // 正式发布频道 const CHAT_ID_TEST = "@vergetest"; // 测试频道 @@ -71,6 +71,19 @@ async function sendTelegramNotification() { .join("\n"); } + function normalizeDetailsTags(content) { + return content + .replace( + /\s*\s*(.*?)\s*<\/strong>\s*<\/summary>/g, + "\n$1\n", + ) + .replace(/\s*(.*?)\s*<\/summary>/g, "\n$1\n") + .replace(/<\/?details>/g, "") + .replace(/<\/?strong>/g, (m) => (m === "" ? "" : "")) + .replace(//g, "\n"); + } + + releaseContent = normalizeDetailsTags(releaseContent); const formattedContent = convertMarkdownToTelegramHTML(releaseContent); const releaseTitle = isAutobuild ? "滚动更新版发布" : "正式发布";