diff --git a/R/output.R b/R/output.R index c97c8bbfe4..448e8885c2 100644 --- a/R/output.R +++ b/R/output.R @@ -465,7 +465,7 @@ wrap.knit_asis = function(x, options, inline = FALSE) { # store metadata in an object named of the form .hash_meta when cache=TRUE if (length(m) && options$cache == 3) assign(cache_meta_name(options$hash), m, envir = knit_global()) - if (inherits(x, 'knit_asis_htmlwidget')) { + if (inherits(x, c('knit_asis_htmlwidget', 'knit_asis_shiny_tag'))) { options$fig.cur = plot_counter() options = reduce_plot_opts(options) return(add_html_caption(options, x)) diff --git a/R/utils.R b/R/utils.R index 038fbb4bc9..e4f6cff994 100644 --- a/R/utils.R +++ b/R/utils.R @@ -752,6 +752,8 @@ knit_handlers = function(fun, options) { # the figure caption to it later in wrap.knit_asis if (inherits(x, 'htmlwidget')) class(res$value) = c(class(res$value), 'knit_asis_htmlwidget') + if (inherits(x, c('shiny.tag', 'shiny.tag.list'))) + class(res$value) = c(class(res$value), 'knit_asis_shiny_tag') if (res$visible) res$value else invisible(res$value) } if (length(formals(fun)) < 2)