{"id":18733516,"url":"https://github.com/insightsengineering/roxy.shinylive","last_synced_at":"2025-10-16T13:32:59.078Z","repository":{"id":253924274,"uuid":"844558085","full_name":"insightsengineering/roxy.shinylive","owner":"insightsengineering","description":"roxygen2 extensions for shinylive","archived":false,"fork":false,"pushed_at":"2025-06-04T12:51:40.000Z","size":8421,"stargazers_count":12,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-04T20:16:28.803Z","etag":null,"topics":["documentation","r","roxygen2","shiny","shinylive","webr"],"latest_commit_sha":null,"homepage":"https://insightsengineering.github.io/roxy.shinylive/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/insightsengineering.png","metadata":{"files":{"readme":"README.md","changelog":"NEWS.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"custom":["https://pharmaverse.org"]}},"created_at":"2024-08-19T13:58:50.000Z","updated_at":"2025-06-04T12:48:58.000Z","dependencies_parsed_at":"2024-10-25T12:41:47.462Z","dependency_job_id":"460d8829-f3e6-41b2-9888-e4de89549b65","html_url":"https://github.com/insightsengineering/roxy.shinylive","commit_stats":null,"previous_names":["insightsengineering/roxy.shinylive"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/insightsengineering/roxy.shinylive","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/insightsengineering%2Froxy.shinylive","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/insightsengineering%2Froxy.shinylive/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/insightsengineering%2Froxy.shinylive/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/insightsengineering%2Froxy.shinylive/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/insightsengineering","download_url":"https://codeload.github.com/insightsengineering/roxy.shinylive/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/insightsengineering%2Froxy.shinylive/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263838820,"owners_count":23518166,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["documentation","r","roxygen2","shiny","shinylive","webr"],"created_at":"2024-11-07T15:10:05.653Z","updated_at":"2025-10-16T13:32:54.030Z","avatar_url":"https://github.com/insightsengineering.png","language":"JavaScript","funding_links":["https://pharmaverse.org"],"categories":[],"sub_categories":[],"readme":"# roxy.shinylive\n\n## Overview\n\nThis package provides a `roxygen2` extension that automatically takes the code\nfrom the `@examples` tag and create an URL to the\n[shinylive.io](https://shinylive.io/) service.\nDuring the documentation build, a new section is added to the function manual\nthat contains the aforementioned link as well as an iframe to the application itself.\n\n### shinylive.io\n\n[shinylive.io](https://shinylive.io/) is a service that allows you to run\n[Shiny](https://shiny.posit.co/) applications entirely in the browser, without\na dedicated server.\nIt uses WebAssembly via [WebR](https://docs.r-wasm.org/webr/latest/).\n\nIt has a sharing feature that allows you to encode the application code in the\nURL.\nThis package does such encoding and returns the URL which can be used in\nvariety of ways (from raw URL to iframe in function manual - see examples\nbelow).\n\n## Install\n\n```r\ninstall.packages(\"roxy.shinylive\")\n```\n\nAlternatively, you might want to use the development version.\n\n```r\n# install.packages(\"pak\")\npak::pak(\"insightsengineering/roxy.shinylive\")\n```\n\n## Usage\n\n### Creating a URL manually\n\n```r\ncode \u003c- \"\\\"Hello World\\\"\"\nroxy.shinylive::create_shinylive_url(code, mode = \"editor\")\n```\n\nThis returns the following URL:\n\n\u003chttps://shinylive.io/r/editor/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAHTAAk4AbRogAgHUiAnRgE1rABfALpA\u003e\n\n### In the roxygen2 documentation\n\nIn your `DESCRIPTION` file, add the following:\n\n```yaml\nRoxygen: list(..., packages = c(..., \"roxy.shinylive\"))\n```\n\nThen in your package documentation:\n\n```r\n#' (docs)\n#' @examplesShinylive\n#' @examples\n#' (example code with a Shiny app)\n```\n\nWhich would produce a following output in your documentation:\n\n```Rd\n\\section{Examples in Shinylive}{\n\\describe{\n  \\item{example-1}{\n    \\href{https://shinylive.io/r/app/#code=...}{Open in Shinylive}\n    \\if{html}{\\out{\u003cscript type=\"text/javascript\"\u003e(custom JS)\u003c/script\u003e}}\n    \\if{html}{\\out{\u003ciframe class=\"iframe_shinylive\" src=\"https://shinylive.io/r/app/#code=...\"\u003e\u003c/iframe\u003e}}\n  }\n  \\item{example-2}{\n    \\href{https://shinylive.io/r/app/#code=...}{Open in Shinylive}\n    \\if{html}{\\out{\u003cscript type=\"text/javascript\"\u003e(custom JS)\u003c/script\u003e}}\n    \\if{html}{\\out{\u003ciframe class=\"iframe_shinylive\" src=\"https://shinylive.io/r/app/#code=...\"\u003e\u003c/iframe\u003e}}\n  }\n  ...\n}\n}\n```\n\n![example of function](man/figures/function.gif)\n\n### In the vignettes\n\nIn your `DESCRIPTION` file, add the following:\n\n```yaml\nSuggests:\n  roxy.shinylive\n```\n\nThen in your vignette:\n\n\u003c!-- markdownlint-disable MD013 --\u003e\n\n````Rmd\n```{r shinylive_url, echo = FALSE, results = 'asis'}\n# extract the code from knitr code chunks by ID\ncode \u003c- paste0(c(\n  ... # add more IDs if needed\n  knitr::knit_code$get(\"app\"),\n  knitr::knit_code$get(\"shinyapp\")\n), collapse = \"\\n\")\n\nurl \u003c- roxy.shinylive::create_shinylive_url(code)\ncat(sprintf(\"[Open in Shinylive](%s)\\n\\n\", url))\n```\n\n```{r shinylive_iframe, echo = FALSE, out.width = '150%', out.extra = 'style = \"position: relative; z-index:1\"', eval = knitr::is_html_output() \u0026\u0026 identical(Sys.getenv(\"IN_PKGDOWN\"), \"true\")}\nknitr::include_url(url, height = \"800px\")\n```\n````\n\n\u003c!-- markdownlint-enable MD013 --\u003e\n\n![example of vignette](man/figures/vignette.gif)\n\nSee the package documentation for more details.\n\n\u003c!-- markdownlint-disable MD013 --\u003e\n\nSee the example implementation in the [`teal.modules.general`](https://insightsengineering.github.io/teal.modules.general/) or [`teal.modules.clinical`](https://insightsengineering.github.io/teal.modules.clinical/) packages.\n\n\u003c!-- markdownlint-enable MD013 --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finsightsengineering%2Froxy.shinylive","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finsightsengineering%2Froxy.shinylive","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finsightsengineering%2Froxy.shinylive/lists"}