[HELP] How to use a JavaScript on Specific Passage Tag

Twine Version: 2.3.7
Story Format: Harlowe 3.1.0 (Latest)

Hello friends,

I’m currently trying to use twine and set-up a mixed language story.
Some of my languages supports RTL formats and the others (Latin) supports LTR format.

I found this script:

$(document.documentElement).attr('dir', 'rtl');

Which makes the whole story texts support RTL language direction.

What do I want to do?
I want to make 2 kind of passage tags: RTL and LTR.

Which I can consider if the passage formatted to RTL or LTR by choosing its own tag.
How do I get it supported? since my code override all story settings.

How can I make it specified by tag?

Thank you for your help,

Try putting this in your story stylesheet?

tw-passage[tags~="rtl"] { direction: rtl; }

I think LTR is always the default in Twine, so you only need to tag the RTL passages? But you can add another rule if you find that’s not true…

Also note that case matters, so if you want your tag to be “RTL” instead of “rtl” then use [tags~="RTL"].

Thank you very much! that worked for me!