I'm trying to create an R Markdown file using the function blogdown::new_post("my new post")
, but it always creates a straight markdown file with a .md
extension.
In the RStudio addin there is an option to change the format to either .Rmd
or .Rmarkdown
(https://bookdown.org/yihui/blogdown/rstudio-ide.html#fig:new-post)
Is there any way to specify R Markdown format with the command line function?
To create R Markdown files with blogdown
on the command line, I've found 2 different options:
blogdown::new_post()
, use the parameter ext
e.g. blogdown::new_post("my new post", ext=".Rmd")
.Rmd
or .Rmarkdown
as the default extension by adding an option in the .Rprofile
file e.g. option(blogdown.ext = ".Rmd")
(Reload the R environment after updating.)For further information on global options see: https://bookdown.org/yihui/blogdown/global-options.html
I didn't find any specific documentation on the function parameters, but entering the function name without the brackets in the terminal e.g. blogdown::new_post
shows the function definition including different possible parameters:
function (title, kind = "", open = interactive(), author = getOption("blogdown.author"),
categories = NULL, tags = NULL, date = Sys.Date(), time = getOption("blogdown.time",
FALSE), file = NULL, slug = NULL, title_case = getOption("blogdown.title_case"),
subdir = getOption("blogdown.subdir", "post"), ext = getOption("blogdown.ext",
".md"))
{