# Set direction of text depending on text itself

**URL:** https://meta.discourse.org/t/set-direction-of-text-depending-on-text-itself/54016
**Category:** Feature
**Tags:** pr-welcome
**Created:** [December 9, 2016, 1:30pm UTC](https://meta.discourse.org/t/set-direction-of-text-depending-on-text-itself/54016 "2016-12-09T13:30:41Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Aymane\_Shuichi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/aymane_shuichi/32/63024_2.png) [@Aymane\_Shuichi](https://meta.discourse.org/u/Aymane_Shuichi)
#### Post date: [December 9, 2016, 1:30pm UTC](https://meta.discourse.org/t/set-direction-of-text-depending-on-text-itself/54016/1 "2016-12-09T13:30:41Z")

</div>

Facebook has it !

 ![](https://global.discourse-cdn.com/meta/original/3X/5/a/5a33daa02b1e0defd0c8b7701df46c97ede7c9a3.jpg)

When Writing with an RTL language the ticker goes to the other way which gives a very intuitive experience.

I need this for my community because we are bilingual.  
Thanks Discourse .. Love

---

<div class="post-metadata">

### Author: ![Aymane\_Shuichi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/aymane_shuichi/32/63024_2.png) [@Aymane\_Shuichi](https://meta.discourse.org/u/Aymane_Shuichi)
#### Post date: [December 13, 2016, 2:00pm UTC](https://meta.discourse.org/t/set-direction-of-text-depending-on-text-itself/54016/2 "2016-12-13T14:00:12Z")

</div>

@codinghorror, Hi Jeff, do you think this is something we can have in the short term ?

---

<div class="post-metadata">

### Author: ![ibnesayeed](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ibnesayeed/32/120427_2.png) [@ibnesayeed](https://meta.discourse.org/u/ibnesayeed)
#### Post date: [December 13, 2016, 2:39pm UTC](https://meta.discourse.org/t/set-direction-of-text-depending-on-text-itself/54016/3 "2016-12-13T14:39:03Z")

</div>

Have a look at an old topic here about RTL support.

[https://meta.discourse.org/t/rtl-support/1784](https://meta.discourse.org/t/rtl-support/1784)

There is a library that automatically sets the direction of each paragraph based on the content.

[https://github.com/hasenj/bidiweb](https://github.com/hasenj/bidiweb)

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [December 16, 2016, 10:23am UTC](https://meta.discourse.org/t/set-direction-of-text-depending-on-text-itself/54016/5 "2016-12-16T10:23:06Z")

</div>

Sure, submit a pull request with the work if you want it. This is how open source works.

---

<div class="post-metadata">

### Author: ![hnaseri](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hnaseri/32/120660_2.png) [@hnaseri](https://meta.discourse.org/u/hnaseri)
#### Post date: [May 25, 2017, 1:19pm UTC](https://meta.discourse.org/t/set-direction-of-text-depending-on-text-itself/54016/6 "2017-05-25T13:19:32Z")

</div>

Is there any update for this feature? I desperately need it.

Even if there is a button to change direction of text, when we write english/arabic/persian, would be great.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [May 25, 2017, 2:48pm UTC](https://meta.discourse.org/t/set-direction-of-text-depending-on-text-itself/54016/7 "2017-05-25T14:48:20Z")

</div>

I just added #pr-welcome on this, hopefully a bilingual developer looking for a contribution will look at this one day.

---

<div class="post-metadata">

### Author: ![hnaseri](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hnaseri/32/120660_2.png) [@hnaseri](https://meta.discourse.org/u/hnaseri)
#### Post date: [June 13, 2017, 11:08pm UTC](https://meta.discourse.org/t/set-direction-of-text-depending-on-text-itself/54016/8 "2017-06-13T23:08:23Z")

</div>

I just found that there is an html5 tag `dir=auto` that simply works in most situations.

For example I wrote this html

```
<html>
<body>

<p dir="auto">Write this جمله چپ به راست text left-to-right!</p>

<p dir="auto">این RTL sentence جمله را از راست به چپ بنویس</p>

</body>
</html>

```

And pasted it in a simple html editor and it works perfectly fine

 ![](https://global.discourse-cdn.com/meta/original/3X/a/3/a3be28ff7fa986538573f419d1131852878a361d.png)

Could we use the same thing in discourse @sam?

---

<div class="post-metadata">

### Author: ![hnaseri](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hnaseri/32/120660_2.png) [@hnaseri](https://meta.discourse.org/u/hnaseri)
#### Post date: [June 14, 2017, 1:22pm UTC](https://meta.discourse.org/t/set-direction-of-text-depending-on-text-itself/54016/9 "2017-06-14T13:22:21Z")

</div>

btw I tried `dir="auto"` with firebug on `<p>` tags in discourse. However it didn’t do anything. I don’t know why.

---

<div class="post-metadata">

### Author: ![rassilon1963](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rassilon1963/32/354656_2.png) [@rassilon1963](https://meta.discourse.org/u/rassilon1963)
#### Post date: [November 14, 2025, 11:31am UTC](https://meta.discourse.org/t/set-direction-of-text-depending-on-text-itself/54016/10 "2025-11-14T11:31:12Z")

</div>

years later, this is still an issue. even when a post is written entirely in an RTL language, it doesn’t get auto-aligned.

 ![Screenshot_20251114_122348](https://global.discourse-cdn.com/meta/original/4X/5/7/a/57a147ae302c0c3553f48e6cbd5cd23b48b460a8.png)  
(this is the editor, but the preview on the right is an accurate representation of the final product)  
the only working solution is to add `<div dir="auto">` tags. as @hnaseri noted, `<p>` doesn’t work, only `<dir>` does.  
 ![Screenshot_20251114_122656](https://global.discourse-cdn.com/meta/original/4X/5/5/0/550d7ef75fd636993bf453d7daa0b88deae085e5.png)  
 ![Screenshot_20251114_122429](https://global.discourse-cdn.com/meta/original/4X/9/b/b/9bbb0323e4db559f8cd6373d66981412aea891ba.png)

i must be honest, this is quite abysmal. surely there’s a better way than to require users to add `<div dir="auto">`. in fact it’s not a good enough solution, because if you just open your div but don’t close it, the rest of the text will be forced to the direction of the very first line, rather than on a paragraph-by-paragraph basis. needing to add another `<div dir="auto">` before every paragraph is not really a solution.

 ![Screenshot_20251114_122937](https://global.discourse-cdn.com/meta/original/4X/7/c/3/7c3c238d6af04898334307d742bb9020f714c4e3.png)  
 ![Screenshot_20251114_122959](https://global.discourse-cdn.com/meta/original/4X/9/d/0/9d0d13f9f55da2eaf1f675976a82e7884170d1aa.png)

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [November 16, 2025, 10:18pm UTC](https://meta.discourse.org/t/set-direction-of-text-depending-on-text-itself/54016/11 "2025-11-16T22:18:59Z")

</div>

![image](https://global.discourse-cdn.com/meta/original/4X/2/4/8/24812ff0e2a1692131786bac84b323350194e8aa.png)

Just confirming this is particularity an issue on English forums where you occasionally post in Hebrew? (mixed language places)

Cause under Hebrew locale everything seems to be OK

One thing that may help here is:

 ![image](https://global.discourse-cdn.com/meta/original/4X/3/c/f/3cf1a3e97b737b6e50414af2ecec0663283112a6.png)

With that button enabled in the toolbar it is far easier as a help here. To enable it you would enable the setting `support mixed text direction`
