Running R from a terminal on Windows show the result below
However, when running the same code from Rstudio the result is TRUE
I hoped that pandoc_available would check if the version installed with Rstudio is available but apparently it does not, at least on Windows. Any workarounds?
"Do it the hard way": Add the path containing the pandoc.exe binary (in your RStudio installation) to the PATHenvironment variable yourself.
Option 1 is the easiest, option 2 - though harder - will ensure you use the same pandoc versions on RStudio as well as on the Windows Terminal. The disadvantage here is that if you remove RStudio (or reinstall into another folder) pandoc is broken in the Windows Terminal.
Folder you need to add to PATH in option 2 is <installation-root>/bin/quarto/binwhere <installation-root> ist the installation directory you chose when installing RStudio.
Thanks @michaelmayer. R may not know about pandoc but I expected the function in rmarkdown to check for an Rstudio installation if it doesn't find pandoc on the path. If that is not feasible, I'll into the 2 options you suggested.
rmarkdown will not check for RStudio installation. It is not that easy as there could be a lot of ways and place to have a software installed. But I agree that could be done this way.
As often with external software, they most of the time add some informations like environment variable when they start, allowing other software to trigger some behavior when run in them.
rmarkdown is checking Pandoc in PATH, and also in RSTUDIO_PANDOC environment variable set by RStudio for a Pandoc binary. It will use the greater version of pandoc found.
So adding to PATH is the correct solution to use Pandoc outside of RStudio IDE.