Markdown Features
RTL & Bidirectional Text

RTL and bidirectional Markdown

mdedit.ai supports both right-to-left and left-to-right writing. With Auto direction, Arabic, Hebrew, English, code, URLs, lists, and tables can share one document while each section remains easy to read.

Choose a direction

Use More → Frontmatter → Writing direction in the web or desktop editor, or save the setting directly in YAML frontmatter:

---
language: ar
mdedit:
  direction: auto
---

The supported values are:

  • auto: let each heading, paragraph, list item, quote, and table cell follow the language it starts with.
  • rtl: make prose consistently right to left.
  • ltr: make prose consistently left to right.

Missing or invalid direction values fall back to Auto. You can also add a standard language code with language or lang, such as ar, he, or ar-SA. This helps browsers and reading tools identify the document language in supported previews and exports.

Test mixed text, nested lists, and code

Copy this sample into mdedit.ai, the browser extension, or the VS Code/Cursor extension:

---
language: ar
mdedit:
  direction: auto
---
 
# مرحبًا بالعالم — Hello world — שלום עולם
 
هذه فقرة عربية with an English phrase وعبارة عبرية שלום בתוך השורה.
 
This paragraph starts in English ثم يكمل بالعربية and ends with עברית.
 
## قائمة متداخلة — Nested list
 
1. العنصر الأول مع `inlineCode("LTR")` ورابط https://mdedit.ai/docs
   - English child item with العربية
   - פריט משנה בעברית with English text
     1. عنصر أعمق — level 3
     2. Deep English item — المستوى الثالث
2. Second ordered item — العنصر الثاني
 
> اقتباس عربي containing English and עברית.
>
> A second quoted line تبدأ بالعربية.
 
```typescript
function greet(name: string) {
  const url = "https://example.com/path?q=rtl";
  return `Hello, ${name}!`;
}
```
 
| الحقل Field | القيمة Value | הערה Note |
| --- | --- | --- |
| الاسم Name | محرر Markdown | עובד ב-RTL |
| URL | https://mdedit.ai | stays LTR |
| كود Code | `const n = 42` | קוד משמאל לימין |
 
## حالات إضافية — Additional cases
 
- العربية تبدأ هذا السطر ثم English follows.
- English starts this line ثم العربية تتابع.
- עברית מתחילה כאן then English continues.
 
نهاية الاختبار — End of test — סוף הבדיקה.

With Auto selected, each heading, paragraph, list item, quote, and table cell follows the language it starts with. Fenced code, inline code, and URLs stay left to right so punctuation and identifiers remain readable.

Browser extension

The Markdown Viewer & Reader popup has a Writing direction selector:

  • Document follows mdedit.direction and falls back to Auto.
  • Auto chooses the reading direction from the text, regardless of the frontmatter setting.
  • Left to right and Right to left explicitly override the document.

Your choice applies to the preview, Raw mode, HTML export, and browser Print / Save as PDF. See the browser extension guide for installation and local-file permissions.

VS Code and Cursor

Set Markdown Viewer & Reader: Preview Text Direction (mdedit.preview.textDirection) to Document, Auto, Left to right, or Right to left. You can choose a default for all projects and use a different setting for an individual folder or workspace. Open previews update immediately, and HTML/PDF exports follow the same choice.

See the VS Code and Cursor extension guide for installation links and export commands.

Export support

FormatDirection behavior
Styled HTML / HTML ZIPMixed-language headings, paragraphs, lists, quotes, and tables keep their reading direction. Code and URLs stay left to right.
PDFDownloaded PDFs and Print / Save as PDF use the same layout as the preview.
DOCXParagraphs, nested lists, and table cells keep their reading direction. Code and URLs stay left to right.
ODTHeadings, lists, and tables keep their formatting and reading direction.
EPUBThe document language and reading direction carry into compatible ebook readers. Code stays left to right.
Markdown / Markdown ZIPYour original frontmatter is preserved unchanged.

PPTX, RTF, and other converted text formats preserve the content, but their RTL layout may vary. For important documents, inspect the final PDF, DOCX, ODT, or EPUB in the app your readers will use.

Troubleshooting

  • If every block starts on the wrong side, choose Auto or correct mdedit.direction in frontmatter.
  • If the document setting is not being followed in an extension, make sure Writing direction is set to Document.
  • If code appears reordered, confirm it is fenced or wrapped in inline backticks.
  • If a language value is ignored, use a valid tag such as ar, he, or ar-SA.
  • If another app loses the layout when converting your Markdown, export it from mdedit.ai as HTML, PDF, DOCX, ODT, or EPUB instead.

Last reviewed