chore: 优化release显示

This commit is contained in:
digua
2026-01-08 10:45:25 +08:00
parent a21ce00b7a
commit d29cbbf7cc
2 changed files with 13 additions and 9 deletions
+7 -3
View File
@@ -61,9 +61,13 @@ const checkUpdate = (win) => {
.replace(/\n{2,}/g, '\n')
.trim()
// 如果包含"下载说明",截断该部分及之后的内容
const downloadGuideIndex = releaseNotes.indexOf('下载说明')
if (downloadGuideIndex > 0) {
// 如果包含下载说明章节,截断该部分及之后的内容(匹配二级标题,支持中英文)
const downloadGuideIndex = Math.min(
...[releaseNotes.indexOf('## Download'), releaseNotes.indexOf('## 下载说明')]
.filter((i) => i > 0)
.concat([Infinity])
)
if (downloadGuideIndex < Infinity) {
releaseNotes = releaseNotes.substring(0, downloadGuideIndex).trim()
}
}