1

In R Markdown we can inform css, csl and bibliograph as external files.

If I want to use a configuration file I need to keep it into the same directory as .Rmd as it is described in https://bookdown.org/yihui/bookdown/usage.html and an example is provided in my answer here: How to set the language in a html document via r markdown html

However, Can I keep the _bookdown.yml file in another directory of my .Rmd file and inform it like includes or something else?

1 Answers1

2

I think it is not possible as inside render_book we have:

config = load_config()  # configurations in _bookdown.yml

where load_config is using . directory.

load_config = function() {
  if (length(opts$get('config')) == 0 && file.exists('_bookdown.yml')) {
    # store the book config
    opts$set(config = rmarkdown:::yaml_load_file('_bookdown.yml'))
  }

Source: https://github.com/rstudio/bookdown

polkas
  • 3,797
  • 1
  • 12
  • 25
  • I know that the purpose of `bookdown` is to write `books`. However, I am planning it to write many reports. It would be nice if I could just inform one path... Thank you @polkas – Guilherme Parreira Oct 27 '20 at 22:39
  • https://stackoverflow.com/questions/39885363/importing-common-yaml-in-rstudio-knitr-document check this out and especially pandoc_args – polkas Oct 27 '20 at 22:45
  • Tks. But it seems that it is not possible to pass those info from `_bookdown.yml` to `YAML` – Guilherme Parreira Oct 28 '20 at 01:39
  • 1
    Yes, pandoc_args is not helping in the case of _bookdown.yml, I wrote why in the answer. It could be helpful in other cases for the future that is why I sent it to you. – polkas Oct 28 '20 at 05:13
  • You want the YAML file to be able to be included at the top of the page from outside the Rmd? – Daniel_j_iii Oct 30 '20 at 01:39
  • No @DanielJachetta, I just want to inform the full path of `_bookdown.yml` inside to YAML (like with bib files), instead of keeping it into the same folder as the `.Rmd` file – Guilherme Parreira Nov 06 '20 at 17:16