Skip to content

Commit cc9b378

Browse files
committed
add figure captioning support for shiny.tag/shiny.tag.list objects
1 parent dccdad7 commit cc9b378

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

R/output.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ wrap.knit_asis = function(x, options, inline = FALSE) {
480480
# store metadata in an object named of the form .hash_meta when cache=TRUE
481481
if (length(m) && options$cache == 3)
482482
assign(cache_meta_name(options$hash), m, envir = knit_global())
483-
if (inherits(x, 'knit_asis_htmlwidget')) {
483+
if (inherits(x, c('knit_asis_htmlwidget', 'knit_asis_shiny_tag'))) {
484484
options$fig.cur = plot_counter()
485485
options = reduce_plot_opts(options)
486486
return(add_html_caption(options, x))

R/utils.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,8 @@ knit_handlers = function(fun, options) {
752752
# the figure caption to it later in wrap.knit_asis
753753
if (inherits(x, 'htmlwidget'))
754754
class(res$value) = c(class(res$value), 'knit_asis_htmlwidget')
755+
if (inherits(x, c('shiny.tag', 'shiny.tag.list')))
756+
class(res$value) = c(class(res$value), 'knit_asis_shiny_tag')
755757
if (res$visible) res$value else invisible(res$value)
756758
}
757759
if (length(formals(fun)) < 2)

0 commit comments

Comments
 (0)