0

Is there a way to detect the Bookdown output directory in code running within an RMarkdown document?

I'm happily using Bookdown to write tutorials using Python code. To make the tutorial interactive, I want to make copies of the .Rmd files as Jupyter Notebooks, and put something like this at top of the relevant .Rmd files:

`r make_link_notebook()`

where the make_link_notebook function creates the Jupyter Notebook file, and makes a link to the notebook within the output document.

To do this, make_link_notebook needs to know where the Bookdown output directory is. By default, of course, this is _book, but I am customizing this in some configuration files, so I want to be able to find the output directory programmatically. Is this possible?

Matthew Brett
  • 863
  • 8
  • 11
  • Have you tried using `knitr::opts_knit$get("output.dir")`? – grrrck Sep 10 '19 at 12:49
  • @grrrck - thanks for the suggestion, but yes, I did try that - it gives the directory of the source (`.Rmd`) file. See [my Github issue](https://github.com/rstudio/bookdown/issues/773) for more discussion and suggestions by Github user `cderv`. – Matthew Brett Sep 11 '19 at 13:03

0 Answers0