Skip to content

Add text-autospace to article view for proper CJK rendering#5235

Open
heyalexhsu wants to merge 1 commit intoRanchero-Software:mainfrom
heyalexhsu:article-text-autospace
Open

Add text-autospace to article view for proper CJK rendering#5235
heyalexhsu wants to merge 1 commit intoRanchero-Software:mainfrom
heyalexhsu:article-text-autospace

Conversation

@heyalexhsu
Copy link
Copy Markdown

@heyalexhsu heyalexhsu commented Apr 8, 2026

Hi team! Love using NetNewsWire and I use it everyday! Also first time submitting a PR! I noticed text-autospace has 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: normal to 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.

Before (without text-autospace) After (with text-autospace)
macOS text-autospace-after text-autospace-before
iOS Simulator Screenshot - iPhone 17 - 2026-04-08 at 15 38 13 Simulator Screenshot - iPhone 17 - 2026-04-08 at 15 37 20

Why declare it explicitly

normal is the spec default in CSS Text 4, but WebKit currently ships with an initial value of no-autospace for backward compatibility, so the property must be set explicitly to take effect.

Compatibility

text-autospace is 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.html rather than body or :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

  • Verified visually on macOS with a Chinese article — extra breathing room appears around Latin/numeric runs in both headings and body text.
  • Verified visually on iOS with a Chinese article.

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.

1 participant