AI Studio Arabic RTL Fix

Fix RTL text direction in AI Studio Google for Arabic language only

作者
Emad Bahattab
日安装量
0
总安装量
5
评分
0 0 0
版本
1.3
创建于
2025-04-30
更新于
2025-04-30
大小
5.9 KB
许可证
MIT
适用于

AI Studio Arabic RTL Fix

Enhanced AI Studio RTL Style for Arabic Language Only

Key Improvements:

  1. Changed List Style Position : Switched from inside to outside for better alignment of bullet points and numbers with text.
  2. Added Proper Margins : Added marginRight to list items to ensure proper spacing between the bullet/number and the text.
  3. Added Arabic-Indic Numbers : Used list-style-type: arabic-indic for ordered lists to display numbers in Arabic numerals.
  4. Added Custom CSS : Created a new function addCustomCSS() that injects a style element with specific CSS rules for RTL lists.
  5. Reduced Padding : Adjusted padding values from 40px to 20px for a more natural appearance.
  6. Improved List Item Display : Set display: list-item to ensure proper rendering of list items.
  7. Version Update : Incremented to version 1.3 to reflect these alignment improvements.
  8. Removed Backticks : Removed backticks from URLs in the metadata section which could cause syntax errors. This enhanced script should now properly align bullet points and numbers with Arabic text in AI Studio, making the content more readable and professionally formatted.

Key Changes Made:

  1. Arabic-Only Detection :
    • Renamed the detection function from containsRTL() to containsArabic()
    • Modified the regex to only include Unicode ranges for Arabic characters
    • Removed Hebrew and other RTL language ranges
  2. Script Metadata Updates :
    • Updated the script name to "AI Studio Arabic RTL Fix"
    • Incremented version to 1.2
    • Updated description to specify Arabic language only
    • Removed backticks around URLs which could cause syntax errors
  3. Enhanced Arabic Support :
    • Changed dir="auto" to explicitly use dir="rtl" for Arabic text
    • Added specific styling for code blocks containing Arabic text
    • Added a preferred font family for Arabic text in code blocks
  4. Maintained List Handling :
    • Preserved the bullet point and numbered list RTL fixes
    • Updated all references to the detection function

How to Use This Script:

  1. Install the Tampermonkey browser extension if you don't have it already
  2. Create a new script in Tampermonkey
  3. Copy and paste the code above
  4. Save the script
  5. Visit aistudio.google.com and the script will automatically apply RTL formatting to Arabic text This script will now specifically target Arabic text while leaving other languages (including Hebrew and Persian) in their default formatting.

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址