Open mkoohafkan opened 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?
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
RSTUDIO_PANDOC
environment variableand 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
pandoc::pandoc_system_*()
functions give info on Pandoc found in PATHpandoc::pandoc_rstudio_*()
functions give info on Pandoc set with RSTUDIO_PANDOC
environment variableHope 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()
pandoc::pandoc_activate()
will run rmarkdown::find_pandoc()
to set a specific Pandoc version to use with any rmarkdown::render()
in the same sessionpandoc::with_pandoc_version()
and pandoc::local_pandoc_version()
are withr-like function to do the same think. Maybe they can be useful with pkgbuild too - unless new background process though...
The
pandoc
package provides a simple way of managing pandoc installs in R. It would be neat ifpkgbuild
could detect if thepandoc
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.