Milad Samimifar162 downloadsSets each line's text direction from the majority of its words, so a Persian, Arabic or Hebrew line that starts with an English word still reads right-to-left.
Right-to-left text in Obsidian that doesn't flip to left-to-right just because the line starts with an English word.
Obsidian picks the direction of each line from its first letter. That works for pure Persian, Arabic or Hebrew. But when you write a lot of technical terms, a line like
checkpoint اول مهمه. بدون اون، اگه کشیدن خراب بشه…
is shown left-to-right because it starts with "checkpoint". The whole paragraph is Persian, and it becomes hard to read.
Smart RTL counts the words instead. If enough of a line's words are right-to-left, the line is right-to-left, whatever it starts with.

Highlighted lines are the ones Smart RTL changes. The last line is mostly English, so it stays left-to-right.
[[some/english/path|این فایل]], only the alias counts.$$ math blocks are always left-to-right, even with Persian inside. Frontmatter is left alone.It works with any right-to-left script: Persian, Arabic, Urdu, Hebrew, Syriac, Thaana, N'Ko and others.
| Command | What it does |
|---|---|
| Toggle on/off | Same as the Enabled setting. You can bind a hotkey to it. |
In Obsidian, open Settings → Community plugins → Browse, search for Smart RTL, then install and enable it.
To install by hand instead, download main.js, manifest.json and styles.css from the latest release. Put them in <your vault>/.obsidian/plugins/smart-rtl/, then turn on Smart RTL under Settings → Community plugins.
npm install
npm run dev # rebuild main.js on every change
npm test # direction detection tests
npm run build # type-check and production build
To try it in a vault, put main.js, manifest.json and styles.css in that vault's .obsidian/plugins/smart-rtl/.
This project is offered for free so everyone can use it without restrictions. If you found this tool useful, you can support its continuous development and improvement through donations.
MIT — see LICENSE.