diff --git a/R/output.R b/R/output.R index e65c50512d..71b4fef442 100644 --- a/R/output.R +++ b/R/output.R @@ -480,7 +480,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 96545e0247..9b4b82a6e4 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)