# Right to Left formatting for Hebrew

If typing in a Hebrew sentence (which I will sometimes do when directly quoting a source, along with a translation into Hebrew), is it possible for format the text from Right to Left? In CSS this would be done by text-direction:rtl for the text block being formatted. However, according to this post it doesn't look like I would be able to do that (I would need to be able to use a style attribute for the <p> html tag).

Edit: Looks like this is already a dormant feature request here, though maybe it is now time to ask again (if you think it is an issue, maybe leave an answer there asking for it or vote up that question).

• At worst case, when this site goes live, we can have them implement it as a site feature - ala LaTex on Tex.SE, MathJax on Math.SE, etc...
– AviD
May 17 '11 at 6:33
• judaism.meta.stackexchange.com/q/5318/759 Yaakov can you take a look
– Double AA Mod
Jun 1 '20 at 22:00
• @DoubleAA it could happen once we get our new editor up. I added it to the wish list for the new editor, but can't make any promises here beyond that for the time being
– Yaakov Ellis StaffMod
Jun 4 '20 at 18:29
• @YaakovEllis Thanks. Better having it on your mind than on no ones.
– Double AA Mod
Jun 4 '20 at 18:30
• @DoubleAA yup. I will be very happy to be able to mark my own feature request from 9 years ago as status-complete.
– Yaakov Ellis StaffMod
Jun 4 '20 at 18:39

## 4 Answers

I recommend http://www.w3.org/International/articles/inline-bidi-markup/, some relevant parts of which as they apply here follow:

1. The basic direction of the page is left-to-right.
2. Any Hebrew will appear right-to-left.
3. Because of item 1, any directionally neutral characters near the Hebrew will appear left-to-right. Hence, if I type "yodea" in Hebrew, a comma, a space, and "know" in English, it comes out as יודע, know.
4. A so-called right-to-left mark is an invisible character that takes up no space on the line and is treated as a right-to-left character. Thus, any directionally neutral characters between it and other right-to-left characters will be surrounded (i.e. on both sides) by right-to-left characters and therefore appear right to left.
5. You insert a right-to-left mark by typing &rlm;.
6. Thus, if I type "yodea" in Hebrew, a comma, a space, &rlm;, and "know" in English, it comes out as יודע, ‏know. Notice that the comma and space are to the left of the Hebrew text.
7. This works well with a period at the end of a Hebrew quotation: add &rlm; after the period, and it will appear to the left of the quotation. An example sentence follows:

משפט אחד יהיה לכם.‏

8. It works with English after also, as follows:

משפט אחד יהיה לכם.‏

Here's a sentence for you.

9. The left-to-right mark &lrm; can be used between adjacent Hebrew texts to serve as a left-to-right character, making the Hebrew texts come out in left-to-right order.

10. Thus, for example, a list of words starting with successive letters of the Hebrew alphabet will come out as אהבה, בטחון, and גדלות, while putting &lrm; after (or before) the comma (or space) between the alef-word and the bes-word will yield אהבה,‎ בטחון, and גדלות as intended.
• I didn't know about this. Thanks. The one thing that this doesn't help with (aside from being pretty annoying to write in, even if you know how to do it) is getting the text to align to the right side of the page when it is in its own text block.
– Yaakov Ellis StaffMod
May 17 '11 at 6:39
• @YaakovEllis, yes, I thought putting a RLM, the double-line-break that makes a new paragraph, your Hebrew text, another double-line-break, and another RLM would make the Hebrew paragraph be aligned right, but it doesn't work (in this browser, at least). I don't think there's a way to do it. Re annoyingness: You get used to it. I have.
– msh210 Mod
May 17 '11 at 14:31
• this help a lot. Align text al="rtl" do not functioning, is ther a solution Mar 18 '16 at 9:03
• @kouty I believe that aligning text rtl is officially not supported, but I can't find the meta post on meta-SE to confirm. Mar 18 '16 at 13:18
• @kouty Perhaps you can specify the circumstances, and what goes wrong, in a new Meta question or in Mi Yodeya Chat.
– msh210 Mod
Mar 18 '16 at 13:31
• @msh210 See for example my post here thanks to the &rlm the points and commas in the end of lines are fixed. but the alignings are not. Before your tutorial, I read this and this but in the stack exchange it is helpless, the website do not support this. But thanks to your post I was able to improve a bit my writings (not English expression but ...) Mar 18 '16 at 13:50
• @kouty, right, that's not supported, alas.
– msh210 Mod
Mar 18 '16 at 14:20

One small step we've taken in this direction (heh) is offering an integrated virtual keyboard which includes a convenient &rlm; key. (You can thank HodofHod for the idea.) As I mentioned on the network-wide request, we don't have any immediate plans to go further. However, internationalization is an important part of our strategy. Please give us feedback about the keyboard (positive, negative, or neutral).

• Something that I see on gmail, which would be awesome to see here, is that if you start typing a paragraph in Hebrew, after you enter the first few characters as Hebrew chars in the WYSIWYG mode, it automatically right aligns that paragraph (by presumably adding an &rlm; notation or something equivalent, in the invisible markup). This works very reliably with the gmail implementation, would be great to see here.
– Yaakov Ellis StaffMod
Sep 28 '13 at 19:21
• I, in turn, would like to thank Menachem for the idea, and Jon and the devs for making it happen. Oct 1 '13 at 8:19

Instead of literally typing &rlm, It is also possible -- and some people would also say easier -- to:

1. use a word processor such as Microsoft Word, OpenOffice, or LibreOffice to edit your text, and to graphically insert the right-to-left character using the appropriate menu item
2. copy and paste the resulting text into your browser, where you are composing/editing your post or comment for StackExchange.com

This is something that we definitely want to support, but we want to do it properly in conjunction with the other localization work that is currently going into the engine. It is possible for us to turn on tweaks to Markdown that allows for these special blocks, but they can (and do) quickly turn into much bigger endeavors than we imagined as we deal with slight differences in design from site to site.

The correct solution isn't asking you to use third party hacks or tricks, or implementing our own hacks or tricks, it's to get localization done and done well - and that's exactly what we're going to do. It is a huge undertaking, however, so I can't promise it any time soon. Luckily, there are ways to work around it, however clunky.

I'll mark this as deferred for now - as we're definitely going to do it - I'm just sorry that I can't give you a better approximation of when we're going to do it. When that's more clear, I will be letting communities that very much want these features know when we'll hopefully have them available.