R/render_html.R

Defines functions notebook_render_html_widget

notebook_render_html_widget <- function(output) {

  unpreserved <- htmltools::extractPreserveChunks(output)

  meta <- base64_encode_object(attr(output, "knit_meta"))

  before <- sprintf("\n<!-- rnb-htmlwidget-begin %s-->", meta)
  after  <- "<!-- rnb-htmlwidget-end -->\n"
  pasted <- paste(before, unpreserved$value, after, sep = "\n")

  annotated <- htmltools::restorePreserveChunks(pasted,
                                                unpreserved$chunks)
  attributes(annotated) <- attributes(output)

  return(annotated)
}

Try the rmarkdown package in your browser

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

rmarkdown documentation built on Nov. 4, 2024, 5:06 p.m.