Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use the new bs4() theme in bookdown?

How can I use the bs4 theme in bookdown, such as the one used for the R4DS book

In the _output.yaml I see the following code, but it doesn't work with my project.

bookdown::bs4_book:
  theme:
    primary: "#637238"
  repo: https://github.com/hadley/r4ds
  includes:
    in_header: [ga_script.html]

and I get this error when I attempt to build the book

Error: 'bs4_book' is not an exported object from 'namespace:bookdown'
Execution halted
like image 992
max Avatar asked Nov 10 '20 23:11

max


1 Answers

I got it to work by doing the following:

Run the following

remotes::install_github("rstudio/bslib")
install.packages("downlit")
remotes::install_github("rstudio/bookdown")

Change the _output.yaml to the following:

bookdown::bs4_book:
  theme:
    primary: "#637238"
like image 188
max Avatar answered Nov 17 '22 01:11

max