-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Add RTL support #13338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Add RTL support #13338
Changes from 12 commits
2691ea5
eecd16e
4d57e27
bcc1783
436ccf1
17a8aa4
86c7135
7d677a1
0435341
08b2cd5
7d37adc
c0aaec6
dc3c2e3
bf24eef
b5f2e67
01ae484
886ba96
dbd3ea4
89ad7a6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -111,6 +111,10 @@ Features added | |||||
| * #13326: Remove hardcoding from handling :class:`~sphinx.addnodes.productionlist` | ||||||
| nodes in all writers, to improve flexibility. | ||||||
| Patch by Adam Turner. | ||||||
| * #10385: Add RTL (right-to-left) support for all Sphinx themes via ``is_rtl`` | ||||||
| theme option. Includes automatic layout mirroring, and bidirectional text | ||||||
| support. | ||||||
| Patch by Revisto. | ||||||
|
||||||
| Patch by Revisto. | |
| Patch by Alireza Shabani. |
Usually we use names (see above entries) rather than github @s but its up to you.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -192,6 +192,16 @@ These themes are: | |
|
|
||
| .. versionadded:: 3.2 | ||
|
|
||
| - **is_rtl** (true or false): Enable right-to-left (RTL) text direction. | ||
| Use this for languages that are read right-to-left (like Farsi, Arabic, | ||
| Hebrew, etc). When enabled, the theme will: | ||
|
|
||
| - Change text direction to RTL | ||
| - Mirror layout components | ||
| - Keep code blocks in LTR direction | ||
|
|
||
| Defaults to ``False``. | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A version added block would be a nice addition |
||
| **alabaster** | ||
| `Alabaster theme`_ is a modified "Kr" Sphinx theme from @kennethreitz | ||
| (especially as used in his Requests project), which was itself originally | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,8 @@ | |
| * Sphinx stylesheet -- agogo theme. | ||
| */ | ||
|
|
||
| @import url("rtl.css"); | ||
|
|
||
| * { | ||
| margin: 0px; | ||
| padding: 0px; | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,152 @@ | ||||||
| {% if theme_is_rtl|tobool %} | ||||||
|
|
||||||
| /* Core RTL overrides for Agogo theme */ | ||||||
| body { | ||||||
| direction: rtl !important; | ||||||
| text-align: right !important; | ||||||
| } | ||||||
|
|
||||||
| /* Header adjustments */ | ||||||
| div.header .headertitle { | ||||||
| text-align: right !important; | ||||||
| letter-spacing: 0 !important; | ||||||
| } | ||||||
|
|
||||||
| div.header div.rel { | ||||||
| direction: rtl !important; | ||||||
| } | ||||||
|
|
||||||
| p.logo { | ||||||
| float: left !important; | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This really shouldn’t be needed. Just change the p.logo {
float: inline-start;
} |
||||||
| } | ||||||
|
|
||||||
| /* Content layout */ | ||||||
| div.document { | ||||||
| float: right !important; | ||||||
| } | ||||||
|
|
||||||
| div.body { | ||||||
| {%- if theme_rightsidebar|tobool %} | ||||||
| padding-left: 2em !important; | ||||||
| padding-right: 0 !important; | ||||||
| {%- else %} | ||||||
| padding-right: 2em !important; | ||||||
| padding-left: 0 !important; | ||||||
| {% endif %} | ||||||
| } | ||||||
|
|
||||||
| /* Sidebar positioning */ | ||||||
| div.sidebar, | ||||||
| aside.sidebar { | ||||||
| {%- if theme_rightsidebar|tobool %} | ||||||
| float: left !important; | ||||||
| {%- else %} | ||||||
| float: right !important; | ||||||
| {% endif %} | ||||||
| } | ||||||
|
|
||||||
| /* Lists and margins */ | ||||||
| div.document ul { | ||||||
| margin-right: 1.5em !important; | ||||||
| margin-left: 0 !important; | ||||||
| } | ||||||
|
|
||||||
| div.document dd { | ||||||
| margin-right: 1.2em !important; | ||||||
| margin-left: 0 !important; | ||||||
| } | ||||||
|
|
||||||
| /* Admonitions */ | ||||||
| div.admonition { | ||||||
| border-right: 0.2em solid black !important; | ||||||
| border-left: none !important; | ||||||
| padding: 2px 7px 1px 7px !important; | ||||||
|
||||||
| padding: 2px 7px 1px 7px !important; |
This is redundant? It is already defined, you are overriding the exact same thing
| padding: 2px 7px 1px 7px; |
I presume there are more cases of this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.