R/utils.R

Defines functions to_json html_format pkg_resource

# a helper function return the paths to resource dirs/files in this package
pkg_resource <- function(...) {
  system.file('resources', ..., package = 'rolldown', mustWork = TRUE)
}

# a wrapper function around bookdown::html_document2() to add extra dependencies
html_format <- function(..., .dependencies = NULL) {
  html_document2 = function(..., extra_dependencies = list()) {
    bookdown::html_document2(..., extra_dependencies = c(
      extra_dependencies, .dependencies
    ))
  }
  html_document2(...)
}

to_json <- function(...) {
  jsonlite::toJSON(..., auto_unbox = TRUE, null = 'null')
}

Try the rolldown package in your browser

Any scripts or data that you put into this service are public.

rolldown documentation built on April 4, 2025, 1:01 a.m.