r-lib / pkgbuild

Find tools needed to build R packages
https://pkgbuild.r-lib.org
Other
66 stars 35 forks source link

work with pandoc package #178

Open mkoohafkan opened 1 year ago

mkoohafkan commented 1 year ago

The pandoc package provides a simple way of managing pandoc installs in R. It would be neat if pkgbuild could detect if the pandoc package is installed and use it to get the pandoc path, rather than requiring users to set environment variables or add pandoc to the path.

gaborcsardi commented 1 year ago

Yeah, we could do that. I guess if there is no pandoc on the PATH, then we could see if the pandoc package is installed, and if it is installed, we could query it to see if some other version of pandoc is available.

It does make the build process somewhat unpredictable, though, but I guess for most people it does not really matter what version of pandoc they are using.

@cderv Which one of these is RStudio using by default, e.g. via the "Knit" button when editing the Rmd. Is it using the "system" version (if any), or the "rstudio" version?

cderv commented 1 year ago

Which one of these is RStudio using by default, e.g. via the "Knit" button when editing the Rmd. Is it using the "system" version (if any), or the "rstudio" version?

It depends - rmarkdown will use the latest Pandoc found by looking at

and it will use the latest version of pandoc found between the two. Unless rmarkdown::find_pandoc() has already been called to cache a specific Pandoc version to use.

RStudio IDE bundles Pandoc, now through its bundled Quarto. It will set this version to RSTUDIO_PANDOC by default if not set already set by the user before running RStudio IDE.

rmarkdown::find_pandoc() returns the version used by rmarkdown::render(), and that should be used when Knit is clicked,

pandoc package aims at simplifying testing and checking R code with different Pandoc versions. For this, it will work by default with its interally managed Pandoc version that can be installed with pandoc::pandoc_install() in a data dir created with rappsdir. pandoc_activate() and friends helps with changing the versions used by pandoc R package functions.

The pandoc package can be used though to retrieve information on other Pandoc version

Hope this clarifies and help

rather than requiring users to set environment variables or add pandoc to the path.

What is the pkgbuild relationship with Pandoc ? Is it for vignette building outside of RStudio IDE (when RSTUDIO_PANDOC is not set) ?

pandoc package has some helper to activate a version to work with rmarkdown::render()

Maybe they can be useful with pkgbuild too - unless new background process though...