typora / typora-issues

Bugs, suggestions or free discussions about the minimal markdown editor — Typora
https://typora.io
1.53k stars 58 forks source link

Mixed RTL and LTR Content #1696

Open MagedMYoussef opened 6 years ago

MagedMYoussef commented 6 years ago

Is there a plan to support mixed RTL and LTR content? Or can I use javascript to add the custom logic for this?

I've also tried using the html div tags that were added in the recent version (0.9.54) but Typora is rendering every line as a separate paragraph tag and it completely ignores my div tags.

abnerlee commented 6 years ago

Do you have any example how it should look like? like HTML or PDF or image?

MagedMYoussef commented 6 years ago

Here's a sample HTML of how the output should look like. I'm thinking it can be automatically implemented using javascript by detecting if the paragraph contains any RTL characters, if so, it would add an RTL class to this paragraph.

abnerlee commented 6 years ago

You can copy the HTML from your snip and paste into Typora, and Typora can rendered it correctly?

So what is the case that Typora cannot handle now?

MagedMYoussef commented 6 years ago

The case when the text contains multiple lines. Typora will convert the first line correctly and ignores the rest of the text. See the below screenshots.

How Typora renders the content, first line only is RTL, others are LTR. image

The source code. image

I have found a workaround by using br tags between the lines instead of using "Enter", and it fixed the issue.

To sum up: the problem specifically happens when I press the "Enter" key inside the html div, this results in breaking the div element and any text entered after pressing "Enter" will go outside the "div" element.

guywaldman commented 5 years ago

+1

I love Typora and this would be a killer feature. Behavior like in Dropbox Paper (automatically detect direction, and possibly even better -- alow control on a per-line basis of a direction) would be amazing.

yitzhakbg commented 5 years ago

Would also love to have Typora support RTL.

itkind commented 5 years ago

How to make a RTL and LTR list? The application "Write!" does it like that:

2018-12-10 21_49_48-untitled-31

Can Typora do the same?

mrg0lden commented 5 years ago

In html there's the attribute dir which can have the value auto

<div dir="auto">My direction depends on my content!</div>

I think it solves the problem and makes things easier

esm7 commented 5 years ago

Why is direction: auto not working in a custom user CSS? When I set direction: rtl under #write it easily makes all the documents display as RTL, but the 'auto' value doesn't seem to do anything.

mrg0lden commented 5 years ago

@esm7 because it's an invalid value. auto is in html's attribute dir only. css direction doesn't have it basically.

esm7 commented 5 years ago

@abnerlee we need your help then, any chance to go for dir="auto"? It sounds like a simple change that will do wonders for RTL users and align Typora with most native apps that handle text direction automatically. When using dir="rtl" things work beautifully for RTL texts, so if it just switched automatically there can be a big check mark on RTL support in Typora.

(I'm not using the solution of a theme with permanent direction: rtl because just a portion of my notes are RTL, and I assume others are not using it for the same reason)

yitzhakbg commented 4 years ago

Any action on this recently?

abnerlee commented 4 years ago

use dir="auto" may require #1939

shaikustin commented 4 years ago

When writing inline math in RTL mode, the inline math gets all mixed up. It seems like adding dir="auto" to the Githubissues.

  • Githubissues is a development platform for aggregating issues.