Skip to content

[Feature] 模组等的更新日志以及 HTMLRenderer 的完善#4828

Open
Calboot wants to merge 121 commits intoHMCL-dev:mainfrom
Calboot:mod-changelog
Open

[Feature] 模组等的更新日志以及 HTMLRenderer 的完善#4828
Calboot wants to merge 121 commits intoHMCL-dev:mainfrom
Calboot:mod-changelog

Conversation

@Calboot
Copy link
Copy Markdown
Contributor

@Calboot Calboot commented Nov 19, 2025

添加了下载模组、数据包等以及更新模组时显示更新日志的功能
Resolves #4685

具体变化:

  • 以下载模组为例,在原来仅用作展示模组依赖项的页面中同时展示该版本更新日志并可跳转到版本发布界面
  • 检查模组更新之后的表格中在最右侧添加“更新日志”列,点击单元格即可打开更新日志并可跳转到版本发布界面
  • 添加打开链接页面的“复制”按钮
  • HTMLRenderer 的优化与完善,以及对 Markdown 的支持(引入了新依赖)

TODO:

  • 添加下载时的更新日志
  • 添加更新模组时的更新日志
  • 给上述功能添加多语言支持
  • HTML
  • Markdown
  • Cache

依赖 #5463

@Calboot Calboot marked this pull request as ready for review November 21, 2025 10:06
@Calboot Calboot marked this pull request as draft November 21, 2025 10:31
可能不准确不地道,需要熟悉这些语言的人验证
@Calboot Calboot marked this pull request as ready for review November 21, 2025 10:44
@Calboot
Copy link
Copy Markdown
Contributor Author

Calboot commented Nov 21, 2025

需要能读懂日语、俄语、乌克兰语、西班牙语的人来审核一下语言文件

我把那些语言的删了,以后再加吧

@Calboot Calboot changed the title 添加模组、资源包、光影包、世界、整合包的更新日志 feat: 模组、资源包、光影包、世界、整合包的更新日志 Nov 22, 2025
@Calboot Calboot changed the title feat: 模组、资源包、光影包、世界、整合包的更新日志 [Feature]: 模组、资源包、光影包、世界、整合包的更新日志 Nov 25, 2025
@Calboot Calboot changed the title [Feature]: 模组、资源包、光影包、世界、整合包的更新日志 [Feature] 模组、资源包、光影包、世界、整合包的更新日志 Nov 25, 2025
# Conflicts:
#	HMCL/src/main/resources/assets/lang/I18N.properties
#	HMCL/src/main/resources/assets/lang/I18N_es.properties
#	HMCL/src/main/resources/assets/lang/I18N_ja.properties
#	HMCL/src/main/resources/assets/lang/I18N_lzh.properties
#	HMCL/src/main/resources/assets/lang/I18N_ru.properties
#	HMCL/src/main/resources/assets/lang/I18N_uk.properties
#	HMCL/src/main/resources/assets/lang/I18N_zh.properties
#	HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties
@Calboot Calboot marked this pull request as draft December 13, 2025 06:43
@Calboot Calboot marked this pull request as ready for review December 13, 2025 07:03
@Calboot
Copy link
Copy Markdown
Contributor Author

Calboot commented Dec 13, 2025

现在对 Markdown 里面的裸超链接还没有进行支持,是否应该支持?

# Conflicts:
#	HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DownloadPage.java

Button changelogButton = new JFXButton(i18n("mods.changelog"));
changelogButton.getStyleClass().add("dialog-accept");
loadChangelog(version, selfPage.repository, changelogButton);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为什么要在 HMCL 里渲染这个更新日志?我没有看出必要性。我认为点击按钮后在浏览器里查看就可以了,不需要在 HMCL 内解析渲染它。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为什么要在 HMCL 里渲染这个更新日志?我没有看出必要性。我认为点击按钮后在浏览器里查看就可以了,不需要在 HMCL 内解析渲染它。

说实话,如果你一开始就是这么想的话,就应该早一点,在去年 11 月 PR 提交后的一段时间里就提出,而不是在 PR 滞留数月,甚至分配给 Copilot 审核的几周后,又给出这个结论。

这个 PR 一开始的目标就是「在 HMCL 内展示 (即渲染) 更新日志」。在今年的一月我还抽时间看了十几个模组、资源包等的实际渲染情况。你可以看中间的对话记录 (默认应该是折叠的)。

如果你之前能够早点提出这个意见,那或许这个 PR 就此结案,不会白白花时间完善之后又滞留数月、不知道命运如何;或者早期沟通后你改变主意,然后 PR 等到今年差不多也顺利合并了。

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为什么要在 HMCL 里渲染这个更新日志?我没有看出必要性。我认为点击按钮后在浏览器里查看就可以了,不需要在 HMCL 内解析渲染它。

为什么这么在意“必要性”?给用户更方便的体验不是很好吗

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为什么这么在意“必要性”?给用户更方便的体验不是很好吗

关键我也不觉得在 HMCL 里显示这个会更方便。我认为这个是低频操作,本身对用户体验的影响不大,而且浏览器窗口通常更大,看这些日志类内容本身就更舒服。

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

关键我也不觉得在 HMCL 里显示这个会更方便。我认为这个是低频操作,本身对用户体验的影响不大,而且浏览器窗口通常更大,看这些日志类内容本身就更舒服。

浏览器里打开的话确实看着舒服,但是现在国内访问 Modrinth 和 CF 都会卡好半天才加载好,体验远不如 HMCL 几乎瞬间渲染完成。更何况看更新日志注重的是内容,能快速而清晰地看到更新内容是远比打开浏览器方便的。

至于“低频操作”,好像真的无所谓吧。能满足少数人(比如我自己)的需求而不会影响大部队的使用体验,为什么不是好事呢?

Copy link
Copy Markdown
Contributor Author

@Calboot Calboot Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2026-03-30.21.38.50.mov
2026-03-30.21.39.26.mov

对比:上面是打开modrinth官方页面查看更新日志的速度,下面是hmcl里加载并渲染更新日志的速度。

个人认为这足以证明这个功能是比打开浏览器看方便的。

更何况这里还是浏览器已经打开的状态。就以现在各大浏览器的臃肿程度来说,启动还得用加个一两秒时间。

@3gf8jv4dv
Copy link
Copy Markdown
Contributor

我不太理解这个 PR 不合并的点在哪。

而且,目前已经有一些启动器,可以展示更新日志,如 XMCL——它使用 Electron,所以对于它而言是「顺手的事」。
HMCL 能实现这个功能的话,也可以吸引青睐此项的用户。

此外我同意 Calboot 说的,

能满足少数人(比如我自己)的需求而不会影响大部队的使用体验

何乐而不为呢?

@Glavo
Copy link
Copy Markdown
Member

Glavo commented Apr 3, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 917d7d9586

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Calboot added 2 commits April 3, 2026 21:33
# Conflicts:
#	HMCL/src/main/resources/assets/about/deps.json
@Glavo
Copy link
Copy Markdown
Member

Glavo commented Apr 3, 2026

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a comprehensive system for displaying mod changelogs and external URLs within the launcher. It adds Markdown-to-HTML conversion using the CommonMark library, enhances the HTMLRenderer to support tables, lists, and code blocks, and integrates these features into the mod download and update pages. Key improvements include a new changelog cache, confirmation dialogs for opening external links, and updated repository interfaces to fetch changelog data from CurseForge and Modrinth. Feedback highlights the need for proper equals/hashCode implementations in the Version class to ensure cache hits, fixing style inheritance in the HTML renderer, and improving the rendering of inline code and table content.

AutolinkExtension.create(), InsExtension.create(), StrikethroughExtension.create(), TablesExtension.create()
)).build();

public static String convertToHtml(String md) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

有必要把 Markdown 转成 HTML 再渲染吗?直接写 Markdown 的渲染器更合适吧?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

两个标记语言写两套完全不同的渲染器感觉没啥好处吧

}
}

public static HTMLRenderer openHyperlinkInBrowser() {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我从这个命名中看不出它会返回一个 HTMLRenderer 实例。

我认为不应该提供这样的方法,还是显式 new 更能体现出每次调用方法都返回了一个新的 HTMLRenderer 实例。

openUriInBrowser(uri.toString());
}

public static void openUriInBrowser(String uri) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这些东西应该放在 Controllers 里,而不是 FXUtils 里。


if (downloadButton == null) {
this.setActions(saveAsButton, cancelButton);
this.setActions(versionPageBtn, changelogButton, saveAsButton, cancelButton);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

考虑把这些链接样式的按钮拆分到单独一行上,不要和 downloadButtonsaveAsButton 还有 cancelButton 在一行里抢地方了。


JFXHyperlink changelogButton = new JFXHyperlink(i18n("mods.changelog"));
changelogButton.setDisable(true);
loadChangelog(version, selfPage.repository, changelogButton);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在点击按钮后再触发加载更合适?大部分时候用户不需要查看更新日志,我认为没有必要为此发起网络请求,给服务器造成没有必要的开销。

applyStyle(textNode);
children.add(textNode);
if (code) {
var codeFlow = new TextFlow(textNode);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

有必要给所有 <code> 标签生成子 TextFlow 吗?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

有的很长的不用textflow就没办法换行了,而需不需要换行并不是很容易判断的事


String style = node.attr("style");
if (StringUtils.isNotBlank(style)) {
styleBuilder.append(StringUtils.addSuffix(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不应该这么简单地处理 CSS 样式,我们可能需要实现更完整的 CSS 解析。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] 更新模组时获取更新日志

5 participants