replicate viewer "export" save as standalone webpage (non-widget) through command

How could I replicate the Rstudio Viewer "export" as standalone webpage via R command for non-widget objects?

I'm familiar with both htmltools::save_html which doesn't solve for a standalone document, and htmlwidgets::saveWidget which doesn't work for non-widget objects.

Has someone been able to replicate the viewer export functionality? For example, if i run the below command, I can save a standalone doc using the viewer export functionality, but haven't found a method to do the same via R command.

Simple reprex below:

library(plotly)
library(tidyverse)
library(shiny)
library(htmltools)

mtcars %>% 
  as_tibble() %>% 
  split(.$cyl) %>% 
  map(~{
    .x %>% 
      plot_ly(x = ~mpg,
              y = ~drat) %>% 
      add_markers() %>% 
      shiny::div(class="col-sm-4")
  }) %>% 
  shiny::fluidPage() %>% 
  htmltools::browsable()

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.