ckoliber / docsify-rtl

Docsify rtl plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Set RTL direction only for one languages not for whole of the languages

BaseMax opened this issue · comments

Hi there;

Is there a way to keep a language RTL?
We are going to have several different languages, one of which is RTL.

Any guidance and help is appreciated.

@BaseMax
You can use <bdo> tags for RTL strings in a LTR context

Set the configuration as bellow:

<script>
    window.$docsify = {
        rtl: {
            body: "ltr",
            side: "ltr",
            bdo: "rtl"
        }
    };
</script>

Hello @ckoliber;

Thanks, But I want to move sidebar and other it's text to right side.

It's what I'm trying..

<style>
/* Persian and Arabic language */
body[data-page^="fa/"] {
  direction: rtl !important;
  text-align: right !important;
  /*--sidebar-width:;*/
}
body[data-page^="fa/"] .sidebar {
  transform: none !important;
  right: 0px !important;
}
body[data-page^="fa/"].close .sidebar {
  right: -300px !important;
}
@media (min-width: 48em) {
  body[data-page^="fa/"] .sidebar+.content {
    margin-left: 0px !important;
    margin-right: var(--sidebar-width) !important;
  }
}
body[data-page^="fa/"] .app-nav {
  left: 30px;
}
body[data-page^="fa/"] .sidebar-toggle {
  transform: none !important;
  right: var(--sidebar-width) !important;
}
body[data-page^="fa/"].close .sidebar-toggle {
  transform: none !important;
  right: 0px !important;
}
@media (min-width: 48em) {
  nav.app-nav {
    margin-left: 0px !important;
    margin-right: var(--sidebar-width) !important;
  }
}
</style>

It's not ready yet and I still need help.

Our documentation has multi-languages. one is LTR and the other is RTL.

Instead of adding custom css code based on your page language, set the plugin config dynamically

For Persian language try rtl body and side, and for English language set direction of body and side to ltr