RTL Preview for Text-based Documents such as Markdown

Hello,

I have noticed that DT’s OCR supports quite many different languages but, unfortunately, Arabic/Hebrew wasn’t one of them. After researching I found that it will costs you much more to license Arabic/Hebrew so you just skipped it for now.

Anyway, there’s no support for RTL documents preview, mainly text-based files such as Markdown.

Many people use Obsidian, LogSeq…etc. as their main note taking app, and these apps saves data as .md files. They do support preview/editing in RTL. Now DT is getting recommended to be used alongside Obsidian as a library manager, specially for academics who, usually, have massive libraries of Word, PDF, Excel…etc files.

Files such as Word, Pages, and PDF are not an issue, as they are already pre-formatted in whatever direction. But that’s not the case currently for text-based docs.

Not asking for anything fancy here, just an option that toggle between LTR/RTL in the built-in DT previewer (picture attached). Usually in CSS direction:rtl; in the body class does it all, at least 90% of the job.

BTW, Marked2 Markdown previewer app does recognise RTL languages (Arabic, Hebrew) automatically and flip into RTL when the file is written in such languages. If you can do something similar then that would be the perfect solution.

Thanks,
Mustafa

What kind of documents? At least in the plain/rich text and Markdown editor the direction can be chosen via the Format menu.

Doesn’t the default writing direction depend on the user’s locale settings? I’d suppose that in an Arabic context, for example, the direction would always be RTL. Seems that the underlying frameworks do The Right Thing:

This doesn’t affect the HTML preview of Markdown documents generated by MultiMarkdown.

Could you please convert a very short MD file to HTML in DT and then have a look in this HTML in the developer tools of your browser? There should be a dir="auto" or dir="rtl" attribute set for the html or the body element (preferably).

If not, you could add

<style>body {direction: rtl;}</style>

to the top of your MD file (yes, I know, that’s not very nice). Alternatively, define a global style sheet in your preferences and add the body stuff there.

That’s of course only a workaround, and DT should set the dir attribute accordingly. I think "auto" would be the best choice here.

Hard to tell, e.g. documents might use various languages and directions independent of the system’s settings.

Presently, DT doesn’t set anything in the html or body elements: neither the lang nor the dir attribute. At least lang could be set if language is present in the MD metadata.

But I agree that the whole rtl-ltr-bidirectional stuff is a mess in Markdown.

The best bet might really be to use dir="auto" on the html element and leave the decision to the browser. That will at least get much of it right. Mixed text, though, might be a problem.

I just added this but the results are mixed at best.