-
Notifications
You must be signed in to change notification settings - Fork 83
Description
Code snippet exchange are being quite popular as reprex for issue filing, shared example or other needs. Currently, they are published most often on SO, GH and Rstudio community, and mainly used as minimal reprex, so short snippet.
Sometimes, reprex can be long on purpose (not minimal reprex) and it could worth being published online for isolation, reuse or just clarity.
A gist seems to me very similar to a code snippet or example, and I used some gist sometimes for that. I think it could be interesting to be able to publish a reprex as a gist containing the source code and the files to create the reprex.
There is one example in this gist where I wanted to publish some code examples online, related to this discussion but outside. For this one, I took the yaml front matter used for reprex to generate the md file and use gistr
📦 to render and publish, as this package has rendering hability like reprex.
callr::r(function() {
gistr::gist_create("map_flat_use_case.R", description = "map_flat usage examples",
knit = TRUE, include_source = TRUE)
}, show = TRUE)
In this case, the R script and the md file are published in the same gist. Reprex is a great way to create quickly a reproductible code using R code and markdown, even for long script. Using Rmd format could have been another way, publish the Rmd file and the md output. But it felt easier to use reprex.
I think it could be useful to have in reprex such a feature of pusblishing results as a gist and retrieve the url to copy-paste somewhere. This would help sharing reprex more easily, even for minimal reprex.
What do you think on this feature ? Is a gist the correct tool for publishing ?
For this gistr
can help and gistfo
can be of inspiration.
Questions identified:
- Which file to publish : R script with user code ?, R script created by reprex ?, code as Rmd file ? md output only ?
- How to deal with external files ? (mainly images, but I think it is ok through imgur
- Should it provide a way to update the gist ?
I can work further on something (i.e a POC) if you want.