Is it possible to run a function during creation of R markdown templates to control what the template loads?

I'm wondering if it possible to run a custom function when loading an R markdown template from R-studio, which can then modify aspects of what the template loads.

I am looking for something similar to what already existing for R-studio project templates, which use a function that can control the population of files/folders inside a new R-studio project.

For example, in my use case, I have an R package that contains an R markdown template. This template includes a folder with a javascript library. Right now, the contents of the javascript library is hard-coded into the inst directory in my R package. I'd like to instead have a function that finds the most recent release of this javascript library (versioned on github), and have that version copied from github into the R markdown template when it is created (e.g., when a user has installed my package, and chooses to create a new R markdown file from this template). I can do this if I was creating a new R-studio project template, just wondering if it can be done with an R markdown template (on creation).

Hope that makes sense, thanks for any help!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.