b3doc is an R package to create Markdown pages for the B-Cubed documentation website from external R Markdown files, such as vignettes. The package has functionality to set the necessary metadata in the front matter.
To get started, see:
- Function reference: overview of all functions.
Installation
You can install the development version of b3doc from GitHub with:
# install.packages("remotes")
remotes::install_github("b-cubed-eu/b3doc")
Usage
Here we use b3doc to read a vignette, run its code and output a Markdown file:
library(b3doc)
# Load packages used in the Rmd file
library(sf)
library(dplyr)
library(ggplot2)
library(tidyterra)
# Convert Rmd to Markdown
rmd_to_md(
rmd_file = "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)
In production, this code is run as part of a script to update the B-Cubed documentation website. Its static website generator then builds the site, using the metadata we provided (such as sidebar_label
).
Meta
- We welcome contributions including bug reports.
- License: MIT
- Get citation information for b3doc in R doing
citation("b3doc")
. - Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
Acknowledgments
This software was developed with funding from the European Union’s Horizon Europe Research and Innovation Programme under grant agreement ID No 101059592.