# Support RTL blocks for LTR-layout website and vice versa

**URL:** https://meta.discourse.org/t/support-rtl-blocks-for-ltr-layout-website-and-vice-versa/48599
**Category:** Feature
**Created:** [13. August 2016 um 18:07 UTC](https://meta.discourse.org/t/support-rtl-blocks-for-ltr-layout-website-and-vice-versa/48599 "2016-08-13T18:07:59Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![SafaAlfulaij](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/safaalfulaij/32/120867_2.png) [@SafaAlfulaij](https://meta.discourse.org/u/SafaAlfulaij)
#### Post date: [13. August 2016 um 18:07 UTC](https://meta.discourse.org/t/support-rtl-blocks-for-ltr-layout-website-and-vice-versa/48599/1 "2016-08-13T18:07:59Z")

</div>

Users would like sometimes to write both RTL and LTR text in one single post.  
Right now, the direction of everything in the website (including text editor and posted posts) depends on the layout of the language used. Arabic means RTL and English means LTR.  
It would be helpful if one can choose that he wants these paragraphs to be opposite the direction of the website.  
I tried:

```
<div dir="rtl">
…
</div>

```

to force a direction change since HTML is supported, but that didn’t do anything, even if _it does_ on GitHub.  
If the above works, then it will be enough as a first step :wink:

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [13. August 2016 um 19:09 UTC](https://meta.discourse.org/t/support-rtl-blocks-for-ltr-layout-website-and-vice-versa/48599/2 "2016-08-13T19:09:13Z")

</div>

You need to whitelist the `dir` attribute. I previously had this working in a plugin, but some changes have been made to the way text is rendered in the latest Discourse release. [Now in master: ES6 Modules + Text Rendering](https://meta.discourse.org/t/now-in-master-es6-modules-text-rendering/46815)  
It won’t be difficult to get it working again.

---

<div class="post-metadata">

### Author: ![elijah](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/elijah/32/104055_2.png) [@elijah](https://meta.discourse.org/u/elijah)
#### Post date: [13. August 2016 um 20:46 UTC](https://meta.discourse.org/t/support-rtl-blocks-for-ltr-layout-website-and-vice-versa/48599/3 "2016-08-13T20:46:27Z")

</div>

It’s a little more awkward, but don’t the RTL and LTR marks work?

> **[Introduction to typing and using RTL (Right to Left) text, and configuring...](https://dotancohen.com/howto/rtl_right_to_left.html)**
>
> A quick introduction to typing and using RTL text in email, documents, and webpages.

---

<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: [13. August 2016 um 20:58 UTC](https://meta.discourse.org/t/support-rtl-blocks-for-ltr-layout-website-and-vice-versa/48599/4 "2016-08-13T20:58:09Z")

</div>

Should this be white listed @eviltrout?

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [14. August 2016 um 00:29 UTC](https://meta.discourse.org/t/support-rtl-blocks-for-ltr-layout-website-and-vice-versa/48599/5 "2016-08-14T00:29:48Z")

</div>

I’ve wanted to figure out how to work with the new text rendering setup for a while now, so I made a plugin that adds bbcode tags for text-direction. It lets you use the tags `[text-direction=rtl][/text-direction]` for rtl text and `[text-direction=ltr][/text-direction]` for ltr text.

I have only tested this lightly on my local setup, so if you use it and run into any problems, let me know. **Note:** this plugin will only work on the latest version of Discourse, where text rendering is using ES6 modules. If you are using an older version of Discourse, it wouldn’t be much work to convert the plugin to work for that.

Check it out here:  
[https://github.com/scossar/discourse-text-direction](https://github.com/scossar/discourse-text-direction)

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [15. August 2016 um 15:19 UTC](https://meta.discourse.org/t/support-rtl-blocks-for-ltr-layout-website-and-vice-versa/48599/6 "2016-08-15T15:19:56Z")

</div>

Sure, this seems reasonable. I’ve whitelisted it:

[https://github.com/discourse/discourse/commit/4d8584f427863fd3bed176808b82e38379c41147](https://github.com/discourse/discourse/commit/4d8584f427863fd3bed176808b82e38379c41147)

---

<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: [18. August 2016 um 15:20 UTC](https://meta.discourse.org/t/support-rtl-blocks-for-ltr-layout-website-and-vice-versa/48599/7 "2016-08-18T15:20:53Z")

</div>

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
