Skip to content

Fix Arabic text alignment in Jupyter Book using RTL direction #1

@Ox03bb

Description

@Ox03bb

Arabic content in the Jupyter Book is currently misaligned because the default text direction is left-to-right (LTR). This affects readability and formatting of Arabic paragraphs.

solution

Wrap Arabic text blocks with an HTML container that enforces RTL direction:

<div dir="rtl">
  النص العربي هنا
</div>

Important note

When using <div dir="rtl">...</div>, Markdown syntax inside the block may not render correctly. This can cause issues with headings, lists, and other Markdown elements.

Example:

Markdown (may break inside <div>):

<div dir="rtl">
# عنوان
</div>

HTML (works correctly):

<div dir="rtl">
  <h1>عنوان</h1>
</div>

For this reason, HTML tags (such as <h1>, <h2>, <p>, <ul>, etc.) should be used instead of Markdown syntax when content is wrapped in an RTL <div>.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions