Amir
Amir

Reputation: 16587

How right to left (RTL) google colaboratory

Jupyter notebook can support RTL text [see here]. I want to know is there anyway to RTL text in Google Colabolatory? Unfortunately, there is no option in command palette to right to left text.

Upvotes: 11

Views: 2357

Answers (2)

PouriaDiesel
PouriaDiesel

Reputation: 735

It is not best answer if you want to display a combination of python and html. you couldn't pass your variables to your HTML so it isn't a good idea. you could use below way:

import IPython
IPython.display.HTML(f'<span dir="rtl">{rtl_string}</span>')

Upvotes: 0

Romi Kuntsman
Romi Kuntsman

Reputation: 482

It's not possible to edit text in right-to-left, but it's possible to display it in a result of a cell:

%%HTML
<div dir=rtl>
טקסט מיושר לימין, עם פסיקים וסימני שאלה. אפשרי?
</div>

It doesn't display correctly here on StackOverflow, but does display correctly in the cell output (i.e. after you run it) in Google Colab notebook.

Upvotes: 12

Related Questions