Markdown Features
RTL & Bidirectional Text

RTL and bidirectional Markdown

mdedit.ai treats right-to-left and left-to-right document layout as a document setting. Arabic, Hebrew, English, code, URLs, lists, and tables can coexist without forcing the whole document into one writing direction.

Choose a direction

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

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

The supported values are:

  • auto: choose direction independently for each prose block from its first strong character.
  • rtl: make prose consistently right to left.
  • ltr: make prose consistently left to right.

Missing, invalid, or malformed direction metadata falls back to Auto. The optional language or lang value accepts a BCP-47 language tag such as ar, he, or ar-SA and is carried into supported HTML-based previews and exports.

Test mixed text, nested lists, and code

Copy this sample into mdedit.ai or either extension:

---
language: ar
mdedit:
  direction: auto
---
 
# مرحبًا بالعالم — Hello world — שלום עולם
 
هذه فقرة عربية with an English phrase וعبارة עברית.
 
1. العنصر الأول مع `inlineCode("LTR")`
   - English child item with العربية
   - פריט משנה בעברית with English text
     1. عنصر أعمق — level 3
 
   ```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 |

Auto direction is evaluated per heading, paragraph, list item, blockquote, and table cell. Fenced code, inline code, and URL runs stay left to right so punctuation and identifiers are not reordered.

Browser extension

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

  • Document follows mdedit.direction and falls back to Auto.
  • Auto ignores the document value and detects each block.
  • Left to right and Right to left explicitly override the document.

The resolved setting applies to preview, Raw mode, standalone HTML export, and browser Print / Save as PDF. Extension controls remain left to right. 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. It is resource-scoped, so a workspace or folder can override your user default. Open previews update immediately, and HTML/PDF exports use the same resolved direction and language.

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

Export support

FormatDirection behavior
Styled HTML / HTML ZIPDocument and content roots receive direction and language; Auto is applied per prose block.
Frontend and backend PDFUses the same annotated HTML layout before browser printing or Chromium rendering.
DOCXParagraphs, nested list items, and table cells receive per-block direction; code and URLs stay LTR.
ODTDerived paragraph and text styles preserve the original heading, list, and table styles while applying direction.
EPUBEvery XHTML document receives direction/language, logical bidi CSS, and LTR code isolation.
Markdown / Markdown ZIPOriginal frontmatter is preserved unchanged.

PPTX, RTF, and converted markup formats preserve the content but are outside the RTL layout guarantee. For important documents, inspect the final PDF, DOCX, ODT, or EPUB in the viewer your readers will use.

Troubleshooting

  • If every block starts on the wrong side, choose Auto or correct mdedit.direction in frontmatter.
  • If an extension ignores frontmatter, choose Document rather than an explicit host override.
  • 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 a third-party converter loses layout, export through mdedit.ai as HTML, PDF, DOCX, ODT, or EPUB.