Skip to content

fix(theme): disable text-autospace in pre elements#3131

Merged
SoonIter merged 1 commit intomainfrom
syt-vibe-kanban/a455-issue
Feb 12, 2026
Merged

fix(theme): disable text-autospace in pre elements#3131
SoonIter merged 1 commit intomainfrom
syt-vibe-kanban/a455-issue

Conversation

@SoonIter
Copy link
Copy Markdown
Member

@SoonIter SoonIter commented Feb 11, 2026

Summary

Related Issue

close #3110

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

AI Summary

Rspress sets text-autospace: normal on :root to improve spacing between CJK (Chinese/Japanese/Korean) and non-CJK characters. However, this also applies to <pre> elements, which causes unwanted extra spacing in code blocks and ASCII art when using CJK-capable monospace fonts.

Changes

  • Added text-autospace: no-autospace to pre elements in packages/core/src/theme/styles/base.css

Why

The text-autospace property inserts spaces between CJK and non-CJK characters, which breaks monospaced alignment in preformatted text blocks (code blocks, ASCII art, etc.). The W3C CSS spec itself plans to exclude <pre> from default text-autospace behavior. This fix aligns Rspress with the spec's intended behavior.

This PR was written using Vibe Kanban


text-autospace: normal on :root causes unwanted spacing between CJK and
non-CJK characters in preformatted text, breaking ASCII art and
monospaced alignment in code blocks. Disable it in <pre> as the W3C
spec intends.
Copilot AI review requested due to automatic review settings February 11, 2026 08:58
@SoonIter SoonIter changed the title issue 处理 (vibe-kanban) fix(theme): disable text-autospace in pre elements Feb 11, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses rspress issue #3110 by preventing text-autospace from affecting ASCII-art / alignment-sensitive content inside <pre> blocks in the default theme styles.

Changes:

  • Add a pre { text-autospace: no-autospace; } rule to disable autospace behavior within <pre>.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying rspress-v2 with  Cloudflare Pages  Cloudflare Pages

Latest commit: ff53615
Status: ✅  Deploy successful!
Preview URL: https://568a9af3.rspress-v2.pages.dev
Branch Preview URL: https://syt-vibe-kanban-a455-issue.rspress-v2.pages.dev

View logs

@github-actions
Copy link
Copy Markdown
Contributor

Rsdoctor Bundle Diff Analysis

Found 3 projects in monorepo, 1 project with changes.

📊 Quick Summary
Project Total Size Change
node 12.0 MB 0
node_md 1.5 MB 0
web 15.8 MB +32.0 B (0.0%)
📋 Detailed Reports (Click to expand)

📁 web

Path: website/doc_build/diff-rsdoctor/web/rsdoctor-data.json

📌 Baseline Commit: fe7210de8a | PR: #3128

Metric Current Baseline Change
📊 Total Size 15.8 MB 15.8 MB +32.0 B (0.0%)
📄 JavaScript 15.5 MB 15.5 MB 0
🎨 CSS 119.7 KB 119.7 KB +32.0 B (0.0%)
🌐 HTML 0 B 0 B 0
📁 Other Assets 166.5 KB 166.5 KB 0

📦 Download Diff Report: web Bundle Diff

Generated by Rsdoctor GitHub Action

@SoonIter SoonIter merged commit 6e86c47 into main Feb 12, 2026
14 checks passed
@SoonIter SoonIter deleted the syt-vibe-kanban/a455-issue branch February 12, 2026 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: text-autospace should be disabled in <pre>

3 participants