ShawHahnLab/chiimp

Report rendering fails with RStudio >= 2022.02 due to pandoc change

Closed this issue · 3 comments

ressy commented

As of version 2022.02 RStudio has a newfangled thing called quarto in place of its previous rmarkdown-rendering system. This has the pandoc executable in a new place, for example on a test install on Windows:

C:\Program Files\RStudio\bin\quarto\bin

This means rendering reports fails (confirmed on Windows and expected on Mac and Linux) due to hardcoded RSTUDIO_PANDOC paths in all three of the Windows/Mac/Linux wrapper scripts chiimp.cmd / chiimp.command / chiimp.sh. The correct path to pandoc should be (well, always should have been) auto-detected.

ressy commented

RStudio 2021.09 still works as expected (just tested on Windows 11).

ressy commented

Things to note about rmarkdown::find_pandoc:

  • Doesn't search recursively through the given directories
  • Crashes if given a directory that contains a directory named pandoc

With that in mind I'm working on a wrapper script to gather up a list of candidate pandoc paths to be called in turn from the chiimp wrapper scripts. We can use find_pandoc if the rmarkdown package is >= version 2.2 but otherwise can just fall back on one of the discovered paths.

ressy commented

On a side note in case I submit an issue... the reason rmarkdown::find_pandoc crashes for a pandoc directory is that it checks for executable paths with utils::file_test("-x", path) and then tries to execute them with system(paste(shQuote(path), "--version"), intern = TRUE) (all in get_pandoc_version called by find_pandoc). But a directory is "executable" so that check doesn't catch it. A call to dir.exists could probably cover this.