hinesboy / mavonEditor

mavonEditor - A markdown editor based on Vue that supports a variety of personalized features
http://www.mavoneditor.com/
MIT License
6.38k stars 916 forks source link

[Feature] Add bidi support #753

Open ahangarha opened 2 years ago

ahangarha commented 2 years ago

🚀 Feature Proposal

Add bidi (bidirectional text) support so without being explicit about direction, text gets rendered in correct direction (RTL or LTR).

Motivation

Not everybody write in Latin script and not all documents are written only in one direction (either RTL or LTR). We need to empower our editors and render engines to handle RTL and LTR without being explicit about the direction of text. Here comes bidi (bidirectional text) support

Example

In most of cases, adding dir="auto" adds such feature to the element containing user generated text. Yet, there shouldn't be absolute references for alignment or border, padding and margin. There are other ways to apply these styles accordingly.

This way, direction of text gets determined by the first strong character.

This is what gitlab uses for a long time and github also added very recently. You may see the following examples:


راست left
یک two سه four

left راست
one دو three چهار


راست left  
یک two سه four

left راست  
one دو three چهار

I am available for any help.

ygj6 commented 2 years ago

Great, I don't know much about this, welcome PR.