### Install rmarkdown Development Version Source: https://github.com/rstudio/rmarkdown/blob/main/README.md Install the latest development version of the rmarkdown package from GitHub using the 'pak' package. Ensure 'pak' is installed first if you don't have it. ```r # install.packages("pak") pak::pak('rstudio/rmarkdown') ``` -------------------------------- ### Pandoc Detection and Versioning Source: https://context7.com/rstudio/rmarkdown/llms.txt Checks if pandoc is installed and meets minimum version requirements. Automatically finds pandoc from the system PATH and RStudio's bundled version. ```R library(rmarkdown) pandoc_available() pandoc_available("2.11") pandoc_version() pandoc_available("2.0", error = TRUE) pandoc_exec() if (pandoc_available("2.19")) { message("Using --embed-resources instead of --self-contained") } ``` -------------------------------- ### Install rmarkdown from CRAN Source: https://github.com/rstudio/rmarkdown/blob/main/README.md Use this command to install the stable version of the rmarkdown package from CRAN. ```r install.packages("rmarkdown") ``` -------------------------------- ### Pandoc Detection Source: https://context7.com/rstudio/rmarkdown/llms.txt Functions to check for pandoc installation and version. ```APIDOC ## pandoc_available() ### Description Checks if pandoc is installed and meets a minimum version requirement. Automatically finds the highest available pandoc from the system PATH and RStudio's bundled version. ### Usage ```R library(rmarkdown) # Check if any pandoc is available pandoc_available() # Check for a specific minimum version pandoc_available("2.11") ``` ## pandoc_version() ### Description Retrieves the exact installed pandoc version. ### Usage ```R pandoc_version() ``` ## pandoc_exec() ### Description Returns the file path to the pandoc binary. ### Usage ```R pandoc_exec() ``` ``` -------------------------------- ### Direct Pandoc Conversion Source: https://context7.com/rstudio/rmarkdown/llms.txt Low-level function to invoke pandoc for arbitrary document conversion. Useful for plain Markdown, bibliography processing, or custom pipelines. Ensure pandoc is installed. ```R library(rmarkdown) pandoc_convert("input.md", to = "html", output = "output.html") pandoc_convert("input.md", to = "latex", output = "output.tex") pandoc_convert("input.md", to = "html", citeproc = TRUE, options = c("--bibliography=refs.bib", "--csl=apa.csl")) pandoc_convert("input.md", to = "docx", output = "report.docx", options = c("--reference-doc=template.docx"), verbose = TRUE) bib_list <- pandoc_citeproc_convert("refs.bib", type = "list") bib_list[[1]]$title ``` -------------------------------- ### Create Document from Template Source: https://context7.com/rstudio/rmarkdown/llms.txt Creates a new .Rmd file from a named template supplied by an installed package or a filesystem path. Templates are located within the package's inst/rmarkdown/templates/ directory. ```R library(rmarkdown) available_templates("rmarkdown") draft("MyReport.Rmd", template = "quarterly_report", package = "pubtools", edit = FALSE) draft("NewDoc.Rmd", template = "/path/to/my-template", create_dir = TRUE) ``` -------------------------------- ### Using Absolute URLs for External Resources Source: https://github.com/rstudio/rmarkdown/wiki/rmarkdown::run-and-external-resources To make external resources accessible in interactive R Markdown documents, reference them using absolute URLs (starting with HTTP or HTTPS). ```markdown ## Enjoy this embedded graph