Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

work with pandoc package #178

Open
mkoohafkan opened this issue Nov 4, 2023 · 2 comments
Open

work with pandoc package #178

mkoohafkan opened this issue Nov 4, 2023 · 2 comments
Labels
feature a feature request or enhancement

Comments

@mkoohafkan
Copy link

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 gaborcsardi added the feature a feature request or enhancement label Nov 4, 2023
@gaborcsardi
Copy link
Member

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
Copy link
Contributor

cderv commented Nov 6, 2023

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 variable
  • pandoc in PATH

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

  • pandoc::pandoc_system_*() functions give info on Pandoc found in PATH
  • pandoc::pandoc_rstudio_*() functions give info on Pandoc set with RSTUDIO_PANDOC environment variable

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()

  • pandoc::pandoc_activate() will run rmarkdown::find_pandoc() to set a specific Pandoc version to use with any rmarkdown::render() in the same session
  • pandoc::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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

3 participants