Add text-autospace to article view for proper CJK rendering#5235
Open
heyalexhsu wants to merge 1 commit intoRanchero-Software:mainfrom
Open
Add text-autospace to article view for proper CJK rendering#5235heyalexhsu wants to merge 1 commit intoRanchero-Software:mainfrom
heyalexhsu wants to merge 1 commit intoRanchero-Software:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi team! Love using NetNewsWire and I use it everyday! Also first time submitting a PR! I noticed
text-autospacehas been supported by major browsers recently and this will make CJK rendering prettier and simpler - a lot of bloggers currently insert spaces manually to achieve the effect, but this is not ideal.I'm not sure where's the best place to add this so currently I added to the article-content classes rather than directly applying to body or article.
Thanks! Let me know your thoughts!
text-autospace - CSS | MDN
Summary
Adds
text-autospace: normalto the article-content classes (.articleTitle,.articleDateline,.articleDatelineTitle,.articleBody) in the shared article-rendering stylesheet, so WebKit inserts the standard 1/4em gap between CJK characters and adjacent Latin alphanumerics/symbols. This matches conventional CJK typography and noticeably improves legibility for articles that mix scripts (common in Chinese/Japanese tech blogs that reference English brand names, library names, or numbers inline).Before / After
Notice there now is a gap between CJK text and alphanumeric text.
Why declare it explicitly
normalis the spec default in CSS Text 4, but WebKit currently ships with an initial value ofno-autospacefor backward compatibility, so the property must be set explicitly to take effect.Compatibility
text-autospaceis supported in WebKit starting Safari 18.2 / macOS 15.2 / iOS 18.2 (late 2024). On older OS versions the declaration is silently ignored — no layout regression.Scope
The rule is scoped to the four article-content classes used in
Shared/Article Rendering/template.htmlrather thanbodyor:root, to keep the change confined to user-generated article content where mixed-script text actually occurs. The header/feed-link chrome is unaffected.Test plan