Skip to content
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

x/tools/cmd/present: enable support for right-to-left languages #11479

saljam opened this issue Jun 29, 2015 · 2 comments

x/tools/cmd/present: enable support for right-to-left languages #11479

saljam opened this issue Jun 29, 2015 · 2 comments


Copy link

@saljam saljam commented Jun 29, 2015

The present tool is currently unusable with right-to-left scripts. Text is left-aligned, and punctuation and English words appear at the wrong end of sentences (see screenshot). This can be fixed by setting the right HTML attributes.

Current output for a slide with Arabic text:
screen shot 2015-06-30 at 02 10 02

Expected output:
screen shot 2015-06-30 at 02 08 28

Adding RTL support would enable slides to be written in Arabic (incl. Farsi & Urdu) and Hebrew

I would implement this by adding a function (e.g. ".rtl") that when invoked would set the RTL mode for the entire presentation. The effects of this would be:

  • add the "dir=rtl" attribute to the <body> tag.
  • add "dir=ltr" to all <pre> tags so code remains correctly formatted.
  • invert the slide switch animation so that the "next" slide is on the left and the "past" slide is on the right.

Adding a special function to set a rarely used mode isn't ideal. I'm open to suggestions of alternatives. Automatically setting it based on the language of the first word might work but isn't "least-surprise".

Copy link

@adg adg commented Jun 29, 2015

I'm happy with .rtl. Alternatively, we could have .mode rtl, although that seems like premature generalization. WDYT @robpike ?

@ianlancetaylor ianlancetaylor added this to the Unreleased milestone Jul 11, 2015
Copy link
Contributor Author

@saljam saljam commented Sep 23, 2015

Hello again,

I hacked this into present but I wasn't particularly pleased with it. The other dot-actions translate to local HTML elements, while something like this modifies the document globally (the body tag, all pre tags, css, etc.).

I ended up writing some javascript I included with .html rtl.html that achieves the desired effect. rtl.html is at

That's good enough for me, so I'm happy if this issue is closed now. If you think it's worth it, I can submit a CL that adds a .rtl action which just translates to that javascript tag.

@gopherbot gopherbot added the Tools label Sep 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.