RTL Fix for ChatGPT / DeepSeek
This userscript intelligently enforces Right-to-Left (RTL) text direction
for chat content on modern SPA-based AI chat platforms such as ChatGPT and
DeepSeek, making Persian, Arabic, Hebrew, and other RTL languages fully
readable and properly aligned.
🔍 How It Works
- Automatically analyzes text content to decide RTL vs LTR
- Uses an optimized MutationObserver for full SPA support
- Processes only real text elements (no UI breakage)
- Preserves correct LTR behavior for:
- Code blocks and preformatted text
- Numbers
- Emojis and symbols
✅ Features
- Smart RTL detection (applied only when needed)
- Works with dynamically loaded messages
- Built-in RTL ON / OFF toggle button
- Remembers user preference via LocalStorage
- Lightweight, fast, and non-intrusive
- No ads, no tracking, no data collection
🧠 Technical Highlights
- Prevents redundant processing using
WeakSet
- Debounced DOM scanning for performance
- Accurate filtering of real text elements
- Unified font stack optimized for mixed RTL / LTR content
🌍 Supported Languages
- Persian (Farsi)
- Arabic
- Hebrew
- Urdu
- Mixed RTL / LTR content
📦 Installation
Install via OpenUserJS using:
- Tampermonkey
- Violentmonkey
🐞 Issues & Feedback
Please report bugs or suggestions on GitHub:
https://github.com/sadat0063/rtl-fix/issues