Bookdown caching

By default, bookdown use a Merge and Knit strategy. That means any code you wrote in setup chunk in index.Rmd for example, would apply to all the documents. other strategy is knit and merge.
See the doc 1.4 Two rendering approaches | bookdown: Authoring Books and Technical Documents with R Markdown

In the knit and merge strategy, you would do that by configuring the option before_chapter_script:

This is a script executed before each chapter and would apply to the knitting of the chapter. I think this would work.

do you know already which strategy you are using (after reading the doc) ?

See the exemple of R4DS book

2 Likes