render with run_pandoc = FALSE
deletes markdown file by default
#1812
Labels
bug
an unexpected problem or unintended behavior
By filing an issue to this repo, I promise that
xfun::session_info('rmarkdown')
. I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version:remotes::install_github('rstudio/rmarkdown')
.I understand that my issue may be closed if I don't fulfill my promises.
Summary
When running
rmarkdown::render
with therun_pandoc = FALSE
option, the markdown file that is generated, and the name of which is returned, is deleted in the clean up process. To keep the file, the optionclean = FALSE
must also be supplied which keeps more than the final markdown file.Reproducible example
Description of example and expected and actual output
As this bug report involves the creation of files in the RMarkdown render process, first create a controlled environment. Use the
skeleton.Rmd
which comes withrmarkdown
as the example file to render. Usetempfile
to get a unique, writable, unused directory that will work for everyone. Create that directory, set the working directory to it, and copy theskeleton.Rmd
file to it. At this point,list.files()
should only return"skeleton.Rmd"
.The first invocation of
rmarkdown::render
has therun_pandoc = FALSE
argument. The output of that (with irrelevant knitting details removed) isrmarkdown::render
correctly returns"skeleton.knit.md"
as the name of the knitted, but not pandoced, file. However, the file itself is not in the directory as seen by the output oflist.files()
. The expected behavior is that"skeleton.knit.md"
would be present in the directory.Invoking
rmarkdown::render
with bothrun_pandoc = FALSE
andclean = FALSE
gives identical printed output for thermarkdown::render
function, butlist.files()
now givesThis behaves as expected and appears to be the only way to get the
"skeleton.knit.md"
file to remain present afterrmarkdown::render()
is run.The final invocation just demonstrates that when pandoc is run, the expected final output file (
"skeleton.html"
) is preserved.Discussion
When
rmarkdown::render()
is invoked with therun_pandoc = FALSE
option, the markdown file created is not an intermediate file, but rather the expected, final output file.clean = FALSE
should not be required to keep that file around as it keeps other files as well.Session Info
This is not the most recent version of R, but as I do not have the ability to install software as it is a work machine, it is what is available. I do not believe that anything in base R should affect this behavior. Installing the latest version of
rmarkdown
from GitHub usingremotes::install_github('rstudio/rmarkdown', upgrade = TRUE)
does not change any outputs or side effects; the same unexpected behavior is there.The text was updated successfully, but these errors were encountered: