Skip to content

fix: prevent inherited text-align justify from distorting table cell text#153

Merged
rohilsurana merged 1 commit into
mainfrom
fix/table-inherited-text-justify
Jun 12, 2026
Merged

fix: prevent inherited text-align justify from distorting table cell text#153
rohilsurana merged 1 commit into
mainfrom
fix/table-inherited-text-justify

Conversation

@rohilsurana

@rohilsurana rohilsurana commented Jun 12, 2026

Copy link
Copy Markdown
Member

Problem

When MDX content wraps a table in an element carrying a presentational alignment attribute (e.g. <p align="justify">, common in content migrated from other doc tools), the text-align: justify inherits into the table. Apsara's Table.Head sets an explicit text-align: left, but Table.Cell declares no text-align, so body cells render justified. Any cell whose text wraps gets stretched, uneven word spacing per line.

Observed on docs.pixxel.space, e.g. the product versions page where every multi-line cell shows large gaps between words.

Fix

Set text-align: start on .content table in both themes (default and paper). This stops inherited alignment at the table boundary while keeping GFM column alignment (:---: / ---:) working, because remark/mdast emits those as align attributes directly on th/td — a presentational hint declared on the cell itself, which wins over the inherited value.

Verification

  • Reproduced and verified against the pixxel documentation site with the locally built CLI: justified gaps gone, cells read normally.
  • Confirmed a cell with align="center" still computes text-align: center under the new rule.
  • bun test: 180 pass. Biome reports only pre-existing warnings on untouched lines.

@vercel

vercel Bot commented Jun 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
chronicle Ready Ready Preview, Comment Jun 12, 2026 11:08am

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR adds explicit text-align: start; styling to .content table rules in both the default and paper theme CSS files to prevent inherited text-justify alignment from content sources from affecting table column alignment.

Changes

Table text alignment across themes

Layer / File(s) Summary
Table text alignment across themes
packages/chronicle/src/themes/default/Page.module.css, packages/chronicle/src/themes/paper/Page.module.css
Both default and paper theme stylesheet .content table rules add explicit text-align: start; declaration to control text alignment and prevent inherited justify alignment from GFM or other content sources from overriding table column alignment.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

  • raystack/chronicle#96: Both PRs modify .content table styling in theme CSS files; PR #96 changes table layout and cell wrapping while this PR adds text-align control.

Suggested reviewers

  • paanSinghCoder
  • rohanchkrabrty
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: fixing inherited text-align justify from affecting table cell text alignment in the CSS stylesheets.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The PR description clearly explains the problem (inherited text-align justify distorting table cells), the fix (adding text-align: start to .content table), and verification steps.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/table-inherited-text-justify

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@rohilsurana rohilsurana merged commit f1c3a05 into main Jun 12, 2026
9 checks passed
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.

2 participants