-
-
Notifications
You must be signed in to change notification settings - Fork 456
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for Right-To-Left text #238
Labels
Comments
Why not for a PR, but just wondering if a CSS could not make this just easier? (Apply automatically dir:auto to any |
@xoofx |
And to be honest, I am more inclined toward the first method: explicitly setting |
So, PR welcome then. |
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Adding support for markdown in achieved by adding
dir
attribute to the rendered html elements. There are two ways of doing that:Either you explicitly mark elements as rtl based on their contents, which is not too hard but might slow things down a bit. Or, you mark all of the structural elements with
dir="auto"
and let the browsers do the heavy lifting.If you are interested, I am willing to send a PR, but I might need some help in some decisions and specific areas (like getting the first character of a block in a fast way, for example). For more information please take a look at dear-github/dear-github#147. Whichever way we choose, it's better than not supporting it at all.
I played with the second idea a bit, it's very easy to implement it. But not every browser supports it according to my tests and no browser seems to support tables. Here is a simple implementation of the second method:
For the following markdown:
The following html is produced (note, to view the html correctly, you might need to have
<meta charset="UTF-8">
in the head of the html document):Screenshot (Chrome):
In Chrome, Opera and Firefox, all of the elements (except for table) are rendered correctly. Unfortunately, Edge and IE don't respect the direction attribute at all (If its set to "auto").
The text was updated successfully, but these errors were encountered: