Skip to content

Commit

Permalink
add figure captioning support for shiny.tag/shiny.tag.list objects
Browse files Browse the repository at this point in the history
  • Loading branch information
cpsievert committed Dec 19, 2019
1 parent 33d69c3 commit d5996a8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion R/output.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 2 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d5996a8

Please sign in to comment.