Converts an R Markdown (.Rmd
) file to a Markdown (.md
) file.
Both local and remote .Rmd
files can be handled.
The date this function is called upon is added to the beginning of the
Markdown file.
Usage
rmd_to_md(
rmd_file,
md_dir,
fig_dir,
fig_url_dir,
title = NULL,
sidebar_label = NULL,
sidebar_order = NULL,
logo = NULL
)
Arguments
- rmd_file
Path to the R Markdown file, either a local path or a URL.
- md_dir
Path to local directory to write the Markdown file to. If it doesn't exist it will be created.
- fig_dir
Path to local directory to write the figures to.
- fig_url_dir
Link prefix that will be used to refer to figures in Markdown output.
- title
Title of the article, to show on top of the page.
Title in the sidebar.
Number indicating the order of the article in the sidebar.
- logo
URL to the logo file that replaces
"man/figures/logo.png"
.
Examples
if (FALSE) { # \dontrun{
# First check and install (or update) packages loaded in the Rmd file
# Then convert Rmd to Markdown
rmd_to_md(
rmd_file = file.path(
"https://raw.githubusercontent.com/b-cubed-eu/gcube/refs/heads/main",
"vignettes/articles/occurrence-process.Rmd"
),
md_dir = "output/src/content/docs/software/gcube",
fig_dir = "output/public/software/gcube",
fig_url_dir = "/software/gcube/",
title = "2. Occurrence process",
sidebar_label = "occurrence-process",
sidebar_order = 2
)
# Clean up (don't do this if you want to keep your files)
unlink("output", recursive = TRUE)
} # }