By default, format html_document
use self_contained=TRUE
, and with this option, intermediates files are cleaned when rendering with default args.
However, rmarkdown::render
has an option clean=TRUE
by default that you could set to FALSE
so that the intermediates directory is not clean as needed by the html file.
---
title: "R Notebook"
output:
github_document: default
html_document:
self_contained: true
---
This is a test file
```{r cars-plot, fig.cap = "plot of cars"}
plot(cars)
```
```{r mean-speed}
mean_speed <- mean(cars$speed)
```
rendered using rmarkdown::render("test.Rmd", clean = FALSE)
will leave the files.
You can also use self_contained: FALSE
and files won't be cleaned.
Now, it seems odd the the whole intermediate dir is cleaned while there is still some files inside (gfm directory). I will look into the source code to see if this is an issue and can be improve.