R/knit_print.R

Defines functions knit_print.svg

Documented in knit_print.svg

#' Safely print any `svg` object in R Markdown
#'
#' This will transform `svg` objects to `knit_print` objects
#'
#' @param x an `svg` object.
#'
#' @keywords internal
knit_print.svg <- function(x, ...) {

  # nocov start

  if (requireNamespace("knitr", quietly = TRUE)) {

    knitr::knit_print(htmltools::HTML(as.character(x)), ...)
  }

  # nocov end
}

Try the omsvg package in your browser

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

omsvg documentation built on Feb. 10, 2021, 5:10 p.m.