sphinx icon indicating copy to clipboard operation
sphinx copied to clipboard

Add RTL support

Open Revisto opened this issue 10 months ago • 3 comments

Purpose

Add RTL (right-to-left) support for all Sphinx themes to improve accessibility for RTL languages like Farsi (Persian), Arabic, and Hebrew.

Key features:

  • Add is_rtl theme option for enabling RTL layout
  • Implement automatic layout mirroring
  • Keep code blocks in the LTR direction
  • Maintain theme-specific styling while supporting RTL

Implementation Details

  1. Added RTL stylesheets to each theme
  2. Updated theme configuration options
  3. Added new theme option is_rtl (defaults to false)
  4. Added documentation for RTL support

Questions

  1. Font Integration
    • Is it a good idea to integrate Vazirmatn font for RTL support?
    • If yes, what's the best approach:
      • Bundle font files with Sphinx?
      • Use CDN?

References

  • Closes #10385

I'm eager to improve this implementation and would love to continue working on it. Open to suggestions and ready to make any necessary changes to align with Sphinx's standards.

Revisto avatar Feb 13 '25 20:02 Revisto

Hi @StanFromIreland, thank you so much for your review.

I fixed the grammar issue, and changed my name to CHANGES.rst. I added the versionadded block in theming documentation. I removed the redundant RTL overrides.

Revisto avatar Feb 15 '25 10:02 Revisto

Hi, I tried to remove the duplications, hope it helps. I'm looking forward to hearing your thoughts.

Revisto avatar Feb 16 '25 01:02 Revisto

Hi all, just following up on this PR 👋

I’ve addressed the feedback (grammar fixes, versionadded, and CSS cleanups) and would love to get this moving. RTL support would really help the ongoing Python Farsi translation and other RTL languages.

Happy to make any further changes if needed, thanks!

Revisto avatar May 08 '25 20:05 Revisto