Skip to content

[Enhancement] enhance html spacing - #6617

Open
ToobLac wants to merge 4 commits into
HMCL-dev:mainfrom
ToobLac:hs
Open

[Enhancement] enhance html spacing#6617
ToobLac wants to merge 4 commits into
HMCL-dev:mainfrom
ToobLac:hs

Conversation

@ToobLac

@ToobLac ToobLac commented Aug 6, 2026

Copy link
Copy Markdown
Contributor
  • 分割线前方添加空行
  • 移除头部的空行以及尾部的空行和空格
  • 渲染时现设置一次图片宽度,以免图片加载得太快导致宽度没有绑定

自己欠的债自己还(

@ToobLac
ToobLac marked this pull request as ready for review August 6, 2026 11:18
@github-actions github-actions Bot added the 10+ label Aug 6, 2026
@github-actions github-actions Bot added 40+ and removed 10+ labels Aug 6, 2026
@Minecraft269

Copy link
Copy Markdown
  • 分割线前方添加空行
  • 移除头部的空行以及尾部的空行和空格

自己欠的债自己还(

属于是没写完Glavo就合了 (bushi

@ToobLac

ToobLac commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

属于是没写完Glavo就合了 (bushi

其实是合并完我才发现有地方不对劲(((

@Glavo

Glavo commented Aug 6, 2026

Copy link
Copy Markdown
Member

@codex review

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

Copy link
Copy Markdown

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: 4c0c8f8510

ℹ️ 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".

Comment thread HMCL/src/main/java/org/jackhuang/hmcl/ui/HTMLRenderer.java Outdated

@Glavo Glavo left a comment

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.

本审查建议由 GPT-5.6 Sol 生成


已将具体审查建议标注在对应代码行。

Comment thread HMCL/src/main/java/org/jackhuang/hmcl/ui/HTMLRenderer.java Outdated
Comment on lines +537 to +540
if (child instanceof AutoLineBreak || child instanceof Text txt && isSpacing(txt.getText())) {
// NO-OP
} else {
this.children.subList(i + 1, size).clear();

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.

[P2] 应清理最后一个文本节点内部的尾随空白

对于 <p>x </p> 这样的内容,Jsoup 会生成 Text("x "),后面再跟一个 AutoLineBreak。由于 isSpacing("x ") 返回 false,当前循环只会删除换行节点,却保留 x 后面的空格。这样不仅未彻底清理尾随空白,还可能影响 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.

我认为这不应该处理。照这么说,一个 Text 节点内如果包含了一堆连起来的换行符岂不是也得找出来?既然空格是节点的一部分就不应该处理

@github-actions github-actions Bot added 10+ and removed 40+ labels Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants