Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML widgets don't appear #443

Open
joelnitta opened this issue Apr 18, 2023 · 1 comment
Open

HTML widgets don't appear #443

joelnitta opened this issue Apr 18, 2023 · 1 comment
Labels
bug Something isn't working frequency: low indicator that a use-case has a low-frequency in lessons nice to have A new feature that would be nice to have, but is not currently a priority

Comments

@joelnitta
Copy link
Contributor

HTML widgets don't seem to appear in output (episodes) built with Rmd. I can't post a single reprex as it is part of a lesson repo including multiple files, but here is a permalink to the episode with the missing output.

The code chunk in question looks like this:

#| label: targets-run-hide-3
#| echo: FALSE
library(targets) # added to this issue post so this chunk works on its own
tar_dir({
  # New workflow
  tar_script({
  summ <- function(dataset) {
    summarize(dataset, mean_x = mean(x), mean_y = mean(y))
  }
  tar_option_set(packages = "dplyr")
  list(
    tar_target(my_data, data.frame(x = sample.int(100), y = sample.int(100))),
    tar_target(my_summary, summ(my_data))
  )
  })
  # Run it again
  tar_make(reporter = "silent")
  tar_visnetwork()
})

I expect to see the targets network as an HTML widget in the output like this, but instead there is just an empty space.

@zkamvar zkamvar added bug Something isn't working nice to have A new feature that would be nice to have, but is not currently a priority frequency: low indicator that a use-case has a low-frequency in lessons labels Apr 18, 2023
@zkamvar
Copy link
Contributor

zkamvar commented Apr 18, 2023

Thank you for the report, Joel. I believe this is an issue with external dependencies provided by HTML widgets. I ran into this once a few years ago in a hugo site and had to implement a pretty ugly solution to save the widgets in a static part of the site (see https://www.reconlearn.org/post/tutorial-post-creation.html#html-widgets-plotly-leaflet and https://github.com/reconhub/learn/tree/master/static/post/widgets/d1_2_files for the resulting widgets).

That being said, I'm almost certain that quarto and RMarkdown have good solutions in them. I hope to work on this after May.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working frequency: low indicator that a use-case has a low-frequency in lessons nice to have A new feature that would be nice to have, but is not currently a priority
Projects
None yet
Development

No branches or pull requests

2 participants