You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
🐛 HTML format result can produce visual difference in Firefox #7304
Prettier considers this rule to some extent in Markdown, but does not use the same rule as Firefox, so we should not reuse the logic used in Prettier to check the character is Chinese/Japanese.
Ok, I think I understand the issue. With regards to whitespace sensitivity, we can't add spaces between characters belonging to languages that don't use spaces as word separators. But it is OK to add newlines because the browser accounts for that.
Note this excerpt from the spec:
Historically, HTML and CSS have unconditionally converted segment breaks to spaces, which has prevented content authored in languages such as Chinese from being able to break lines within the source. Thus UA heuristics need to be conservative about where they discard segment breaks even as they strive to improve support for such languages.
I think it makes sense to diverge from prettier for this case.
I think it makes sense to diverge from prettier for this case.
Prettier's behavior should be changed. Biome is going to be just ahead of the curve. We have to report an issue in Prettier's repo but it is difficult to generate an example that is different between the current Prettier and Firefox.
But it is OK to add newlines because the browser accounts for that.
If "add newlines" means "break the line into two in a Chinese/Japanese line at an arbitrary point", we should avoid it as for now. It causes an extra space there like the above screenshots in unsupported (KHTML/WebKit-derived) browsers. Biome should try to provide the same appearance in all browsers before and after formatting.
Activity
tats-u commentedon Aug 25, 2025
Firefox's Chinese/Japanese character meets all of:
A variation selector before the newline is ignored. (Update: Firefox's implementation is to check the
Default_Ignorable_Code_Point(DI) property of one or more preceding characters)Additional rules in Chinese & Japanse:
If at least one of the sides is CJK punctuations, the space is removed, too. The CJK punctuation meets all:
https://github.com/mozilla-firefox/firefox/blob/66bb0c6d60554576b420b8e7138554c9edcdcc17/intl/unicharutil/util/nsUnicharUtils.cpp#L524 (Caution: the code is MPL!)
w3c/csswg-drafts#5086
dyc3 commentedon Aug 25, 2025
Ok, I think I understand the issue. With regards to whitespace sensitivity, we can't add spaces between characters belonging to languages that don't use spaces as word separators. But it is OK to add newlines because the browser accounts for that.
Note this excerpt from the spec:
I think it makes sense to diverge from prettier for this case.
tats-u commentedon Aug 25, 2025
Web Platform Tests: https://wpt.fyi/results/css/css-text/line-breaking?label=master&label=experimental&aligned&q=segment-break-transformation-
Prettier's behavior should be changed. Biome is going to be just ahead of the curve. We have to report an issue in Prettier's repo but it is difficult to generate an example that is different between the current Prettier and Firefox.
If "add newlines" means "break the line into two in a Chinese/Japanese line at an arbitrary point", we should avoid it as for now. It causes an extra space there like the above screenshots in unsupported (KHTML/WebKit-derived) browsers. Biome should try to provide the same appearance in all browsers before and after formatting.
FYI Prettier's algorithm:
https://github.com/prettier/prettier/blob/main/src/language-markdown/utils.js
https://github.com/prettier/prettier/blob/main/src/language-markdown/constants.evaluate.js
https://github.com/ikatyang-collab/cjk-regex/blob/main/src/index.ts
Update dependency @biomejs/biome to v2.5.14 (#24)
Update dependency @biomejs/biome to v2.5.14 (#45)