R/shiny.R

Defines functions renderXmlview xmlviewOutput

Documented in renderXmlview xmlviewOutput

#' Widget output function for use in Shiny
#'
#' @param outputId outputId
#' @param width width
#' @param height height
#' @export
xmlviewOutput <- function(outputId, width = '100%', height = '400px'){
  htmlwidgets::shinyWidgetOutput(outputId, 'xmlview', width, height,
                                 package = 'htmltidy')
}

#' Widget render function for use in Shiny
#'
#' @param expr expr
#' @param env env
#' @param quoted quoted
#' @export
renderXmlview <- function(expr, env = parent.frame(), quoted = FALSE) {
  if (!quoted) { expr <- substitute(expr) } # force quoted
  htmlwidgets::shinyRenderWidget(expr, xmlviewOutput, env, quoted = TRUE)
}
hrbrmstr/htmltidy documentation built on Aug. 16, 2022, 4:39 p.m.