[Feature] 模组等的更新日志以及 HTMLRenderer 的完善#4828
Conversation
|
我把那些语言的删了,以后再加吧 |
# 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
# Conflicts: # HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ModUpdatesPage.java
|
现在对 Markdown 里面的裸超链接还没有进行支持,是否应该支持? |
Solved |
|
HMCL jar 文件体积变大了 0.2MB,应该问题不大吧…? |
# Conflicts: # HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DownloadPage.java
# Conflicts: # HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DownloadPage.java # HMCL/src/main/resources/assets/css/root.css
|
我不太理解这个 PR 不合并的点在哪。 而且,目前已经有一些启动器,可以展示更新日志,如 XMCL——它使用 Electron,所以对于它而言是「顺手的事」。 此外我同意 Calboot 说的,
何乐而不为呢? |
|
@codex review |
There was a problem hiding this comment.
💡 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".
# Conflicts: # HMCL/src/main/resources/assets/about/deps.json
|
/gemini review |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
有必要把 Markdown 转成 HTML 再渲染吗?直接写 Markdown 的渲染器更合适吧?
There was a problem hiding this comment.
两个标记语言写两套完全不同的渲染器感觉没啥好处吧
|
|
||
| if (downloadButton == null) { | ||
| this.setActions(saveAsButton, cancelButton); | ||
| this.setActions(versionPageBtn, changelogButton, saveAsButton, cancelButton); |
There was a problem hiding this comment.
考虑把这些链接样式的按钮拆分到单独一行上,不要和 downloadButton、saveAsButton 还有 cancelButton 在一行里抢地方了。
There was a problem hiding this comment.
我能理解现在这样会抢视觉重心,但问题在于那个小对话框本来就没多大地方,其他地方要么放不下要么很突兀,还不如现在这里
| applyStyle(textNode); | ||
| children.add(textNode); | ||
| if (code) { | ||
| var codeFlow = new TextFlow(textNode); |
There was a problem hiding this comment.
有的很长的不用textflow就没办法换行了,而需不需要换行并不是很容易判断的事
|
|
||
| String style = node.attr("style"); | ||
| if (StringUtils.isNotBlank(style)) { | ||
| styleBuilder.append(StringUtils.addSuffix( |
There was a problem hiding this comment.
不应该这么简单地处理 CSS 样式,我们可能需要实现更完整的 CSS 解析。
There was a problem hiding this comment.
写了一个很简单的解析,看看行不行
此账号为 @Calboot 暂时的备用账号,只发表评论不提交代码
# Conflicts: # HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DownloadPage.java
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3c3a132d0d
ℹ️ 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".
| public String getVersionPageUrl(RemoteMod.Version version) { | ||
| return "%s/mod/%s/version/%s".formatted(BASE, version.getModid(), version.getVersionId()); // Modrinth will help us redirect |
There was a problem hiding this comment.
Build Modrinth version URLs with project type
getVersionPageUrl always emits a /mod/... path, but this repository class is also instantiated for modpack, resourcepack, and shader project types. For those instances, the generated link points to the wrong route, so the new “mods.url” action can open a non-canonical or broken page instead of the target version. Use projectType (or a type-agnostic route) when composing the URL.
Useful? React with 👍 / 👎.
| if (e != null) { | ||
| LOG.warning("Failed to load image: " + src, e); | ||
| return; | ||
| } |
There was a problem hiding this comment.
Preserve alt text when async image loading fails
After moving image loading to async, the failure callback only logs and returns; by then an empty ImageView is already inserted and the method has returned, so the alt fallback text is never shown for network/decoding failures. In constrained/offline environments this drops changelog content that previously remained readable via alt text.
Useful? React with 👍 / 👎.

添加了下载模组、数据包等以及更新模组时显示更新日志的功能
Resolves #4685
具体变化:
HTMLRenderer的优化与完善,以及对 Markdown 的支持(引入了新依赖)TODO:
依赖 #5463