I have multiple chapters in their own Rmd files and _bookdown.yml
and _output.yml
files which builds a book as expected. I am writing a thesis and some of these chapters include YAML headers which should render them independently as articles for particular journals. However I can't find a way to make bookdown honour these header blocks while the book's _bookdown.yml
and _output.yml
files are around. gitbook::render_chapter()
does not do this.
So, how can we tell bookdown to ignore the _bookdown.yml
and _output.yml
files and instead render a chapter using its own YAML header?
A solution is to create a _bookdown_mychapter.yml
file particularly for each chapter that needs to be built as an article. In here include rmd_files: ["mychapter.Rmd"]
to tell bookdown to include only the single chapter. Then use
bookdown::render_book("mychapter.Rmd", config_file = "_bookdown_mychapter.yml")
to specify that this YAML file should be used instead of the default _bookdown.yml
.