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

No RTL Support & Search not working for languages like arabic or persian! #2316

Open
nimafanniasl opened this issue Feb 13, 2024 · 6 comments
Labels
C-bug Category: A bug, incorrect or unintended behavior

Comments

@nimafanniasl
Copy link

nimafanniasl commented Feb 13, 2024

Problem

Hey! I'm working on a website with mdBook that is written in Persian and I stumbled upon these issues:

First: There is no RTL support. I fixed the problem at least for the content itself in the book with this CSS:

#content > main:nth-child(1) > * {
    text-align: start;
    unicode-bidi: plaintext;
}

But still, as you can see, some parts aren't fixed with this fix.

I think it's a simple fix, but it's really needed!

Second problem:
Search doesn't work for Arabic/Persian text but works perfectly for English!

Screenshot from 2024-02-13 22-36-07

Steps

  1. Make a new project
  2. Write some Persian/Arabic Text in it
  3. Search for the Persian/Arabic Text

Possible Solution(s)

No response

Notes

No response

Version

mdbook v0.4.37
@nimafanniasl nimafanniasl added the C-bug Category: A bug, incorrect or unintended behavior label Feb 13, 2024
@ehuss
Copy link
Contributor

ehuss commented Feb 13, 2024

Thanks for the report! To support RTL, you need to set the book.text-direction option (see docs).

As for search support, that is tracked in #1081.

@nimafanniasl
Copy link
Author

Hey! Thanks so much.

Also, is there a way to have English text be LTR and Persian/Arabic text automatically be RTL with the config file or does this still need custom css?

@ehuss
Copy link
Contributor

ehuss commented Feb 14, 2024

I don't think there is an automatic way to handle that based on the script. You can wrap text in something like <div dir="ltr"> to switch it.

@mo1ein
Copy link

mo1ein commented Feb 27, 2024

That's right. Search non-English languages are not supported. But for RTL, you can handle it like these:

<ul dir="rtl">
    <li>صفحه اصلی</li>
</ul>

or

<p dir="rtl">سلام</p>

@nimafanniasl
Copy link
Author

nimafanniasl commented Feb 27, 2024

Hi!
Yeah, but setting it manually isn't a good way to do it, But the CSS I shared above works fine as a custom CSS and does this automatically :)

#content > main:nth-child(1) > * {
    text-align: start;
    unicode-bidi: plaintext;
}

The main problem for me is the search not working for Persian text :)

@miaomiao1992
Copy link

Any new progress on this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: A bug, incorrect or unintended behavior
Projects
None yet
Development

No branches or pull requests

4 participants