rr-markdownright-to-leftbookdown

bookdown righ to left direction


Recently I started to write a book with R package bookdown. As I want to write a Persian book (Right to left Direction), I want to change the text direction of book, but I can't find a way to do that, so if anyone faced with similar problem and solve it in any way, I will be happy to share it with me.

You can config with the bookdown demo project.


Solution

  • there's a style.css in your project, render your project then use inspect element in browser, and find right properties for your .html files, it's simple. if you use bs4 book this may help you:

    .row{
      flex-direction: row-reverse;
    }
    header{
      direction: rtl;
      text-align: right;
    }
    main{
      direction: rtl;
      text-align: right;
    }
    nav{
      direction: rtl;
      text-align: right;
    }
    pre{
      direction: ltr !important;
      text-align: left !important;
    }