Created
July 6, 2022 23:44
-
-
Save jvelezmagic/0dd5df363089c9aa8ae7a523d1387923 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
render_md_as_rmd <- function(file, overwrite = TRUE, ...) { | |
file_name <- fs::path_ext_remove(file) | |
file_to_render <- fs::file_copy( | |
path = file, | |
new_path = fs::path(file_name, ext = "Rmd"), | |
overwrite = overwrite | |
) | |
tryCatch( | |
{ | |
xfun::Rscript_call( | |
fun = rmarkdown::render, | |
args = list(input = file_to_render, ...) | |
) | |
}, | |
finally = { | |
fs::file_delete(file_to_render) | |
} | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment