Search code examples
rrstudio

How to stop RStudio from rendering nb.html on save of an R Markdown document


RStudio renders mynotebook.nb.html file every time R Markdown document mynotebook.Rmd is saved. This process does not involve running code in chunks, so it is much faster than knitting a notebook into mynotebook.html. However, for large .Rmd documents, saving nb.html files can take a long time, and, unfortunately, it is required to wait for it to finish before one can start using the notebook again and run code in chunks.

Is there a way to configure RStudio to not to create nb.html files on save of an R Markdown document?


Solution

  • I've found out you can delete relevant output entry from the top section of your file. In my case it looks like:

    ---
    title: "Document"
    output:
    html_notebook: default
    ---
    

    Which causes creation of .nb.html on every save. If you remove the output tag, file is no longer created automatically. You can still knit to any output file from the Knit menu on the top (or press Ctrl+Shift+K for default. This will run all the chunks again, which may take a while.

    You may want to consult this guide book for more information on how YAML tags work. I'm just beginning with them!