Knit button in RStudio only calls render_site()

Hi,

I noticed that when I click the "Knit to PDF" or "Knit to Word" options in the Knit pulldown menu, RStudio will run rmarkdown::render_site() in any case, so I'm only getting HTML outputs. If I use rmarkdown::render() manually in the console, everythings work fine.

These is the YAML section in my .Rmd:

---
title: "COVID LUS Stats Report"
output:
  pdf_document:
    toc: yes
  html_document:
    fig_caption: yes
  word_document:
    toc: yes
    fig_caption: yes
----

Can anyone explain how the Knit button got overridden and how can I get it back?

Update: obligatory screen capture gif:

Thanks!

Hi @mbac,

RStudio is probably using rmarkdown::render_site() instead of render() because you have named your file index.Rmd which is a naming convention for websites. Do you have a _site.yml file in the same directory?

Based on the pandoc command, it looks like it is still rendering out the word document --output index.docx, or at least named as if it were a Word doc.

1 Like

Thank you both for the explanations, there is indeed a _site.yml file in the root folder. I’ll change the .Rmd file name before knitting to Word…

Thanks!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.

It would use render_siteinstead of render if the file is called index.Rmd AND there is a site: field with a render function. Otherwise, it would be if there is a _site.yml file present in the project root file as you said, and it that case the default rmarkdown website renderer would be used.

1 Like