In the learnr R package, one suggestion for distribution is to bundle up tutorials into a package. However, to include custom css for a tutorial, it seems to require putting your .css file inside the unique subdirectory associated with each tutorial as:
+ inst/
| + tutorials/
| | +- tutorial_A/
| | | +- tutorial_A.rmd
| | | +- custom.css
| | +- tutorial_B/
| | | +- tutorial_B.
| | | +- custom.css
The css file can be included with the yaml argument css: custom.css
. Is there a way to simply put a single custom.css
file in a higher-level directory (say as inst/tutorials/custom.css
if it is shared by both tutorials? I've tried both relative and absolute paths, and nothing seems to work including the rather exotic yaml
css: !expr system.file("tutorials/custom.css", package="my_package")
.
Note: I'm referring to an installed package and a tutorial loaded with learnr::run_tutorial('tutorial_A', 'my_package')
. Simply running the Rmarkdown itself works.