10

I keep getting [WARNING] Deprecated: --self-contained. use --embed-resources --standalone when saving a plotly plot as a self-contained html widget, using htmlwidgets::saveWidget(..., selfcontained = TRUE).

I can't figure out how to use "embed-resources" or "standalone" as arguments in the function. This just recently started, wondering if anyone else has had this warning occur, or knows the proper arguments to use for this. Updated RStudio and the package, but the warning persists.

Using R 4.2.1, RStudio 2022.07.2+576 "Spotted Wakerobin", htmlwidgets 1.5.4.

library(plotly)
library(htmlwidgets)

fig <- plot_ly(x = 1:10, y = 1:10, type = "scatter", mode = "lines")
htmlwidgets::saveWidget(partial_bundle(fig), file = "plotly.html", selfcontained = TRUE)
utils::browseURL("plotly.html")
ismirsehregal
  • 30,045
  • 5
  • 31
  • 78
bt3
  • 156
  • 1
  • 10
  • 3
    I can't reproduce the issue with plotly v4.10.1 and htmlwidgets v1.5.4 and RStudio 2022.07.1 Build 554. I left an example above. However, here you can find a [related issue](https://github.com/rstudio/rmarkdown/issues/2382). The warning seems to be raised by [pandoc](https://github.com/jgm/pandoc/issues/7331). Maybe a new pandoc version is shipped with the latest RStudio installer? – ismirsehregal Nov 10 '22 at 08:49
  • That's a Pandoc change in version 2.19. You can see what version you're using with `htmlwidgets:::pandoc_available(); htmlwidgets:::.pandoc$version`. I think RStudio distributes version 2.18, but they may have updated, or you may have installed it separately. – user2554330 Dec 11 '22 at 16:09

1 Answers1

5

That's a Pandoc change in version 2.19. You can see what version you're using with htmlwidgets:::pandoc_available(); htmlwidgets:::.pandoc$version. I think RStudio distributes version 2.18, but they may have updated, or you may have installed it separately.

The Pandoc change log is here: https://pandoc.org/releases.html .

I don't think there's any way to fix that other than editing the htmlwidgets source. Maybe this will be fixed in the next release?

EDITED to add: This change has been handled in rmarkdown for a while, but htmlwidgets was calling Pandoc directly. The next release (1.6.0) of htmlwidgets will fix it by letting rmarkdown handle the call. This should also future-proof it a bit.

user2554330
  • 37,248
  • 4
  • 43
  • 90