rmarkdown icon indicating copy to clipboard operation
rmarkdown copied to clipboard

[FR] Use base-R standalone files for functionality copied in Positron?

Open lionel- opened this issue 6 months ago • 2 comments

It might be helpful if the functionality we copied over to Ark for tool calls in Positron was implemented in base-R only standalone files. This way the functionality is updated and tested in one place, usethis can be used to manage updates (https://usethis.r-lib.org/reference/use_standalone.html), and we wouldn't need to adapt the code to base R when we need to update.

You can see which functions we adapted in https://github.com/posit-dev/ark/pull/868 (file pandoc.R).

This is just a suggestion, I'd understand if you think this would be impractical or too constraining on your end.

lionel- avatar Jul 10 '25 10:07 lionel-

Thanks for the suggestion. As this is directly Pandoc only related, I wonder if this should be in https://github.com/cderv/pandoc (which I did not yet moved to rstudio or posit-dev org... 🤔 I could).

However, rmarkdown may be the best place as the function seems to clearly be adapted from this package. (find_pandoc() logic). In pandoc R 📦 this is only used in pandoc_activate(rmarkdown = TRUE). Otherwise the logic is different.

This is just a suggestion, I'd understand if you think this would be impractical or too constraining on your end.

I am fine with this idea.

Would that mean we would use the standalone function and replace current implementation of find_pandoc() or pandoc_convert() ?

How does that work in other packages ?

In https://github.com/posit-dev/ark/pull/868 I read

Since the standalone file is in the original repo and has clear dependency goals (for example only base R) that the maintainer abides to, this makes it easy to update upstream changes from downstream.

So there have constraint to abide to. 🤔

cderv avatar Jul 10 '25 12:07 cderv

Would that mean we would use the standalone function and replace current implementation of find_pandoc() or pandoc_convert() ?

yep that's usually how it works, the package just uses the definitions from the standalone files.

So there have constraint to abide to. 🤔

yep in this case the constraint would be using only base R in that file with long term compatibility with old R versions. That's mainly why I mentioned to not worry about this if too impractical on your end.

lionel- avatar Jul 10 '25 14:07 lionel-