{"id":29729129,"url":"https://github.com/coatless-r-n-d/webr-in-pkgdown","last_synced_at":"2026-05-15T23:01:49.456Z","repository":{"id":303566083,"uuid":"1015845769","full_name":"coatless-r-n-d/webr-in-pkgdown","owner":"coatless-r-n-d","description":"WebR Roclet for pkgdown demo","archived":false,"fork":false,"pushed_at":"2025-07-13T08:40:41.000Z","size":1069,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-25T07:04:49.881Z","etag":null,"topics":["interactive-documentation","pkgdown","r-package-development","r-programming","rstats","wasm","webr"],"latest_commit_sha":null,"homepage":"https://rd.thecoatlessprofessor.com/webr-in-pkgdown/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/coatless-r-n-d.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-08T06:02:56.000Z","updated_at":"2025-07-13T08:40:45.000Z","dependencies_parsed_at":"2025-07-08T09:46:44.314Z","dependency_job_id":"2d81cdc3-8eac-43d7-ac7b-b149eee8f2b3","html_url":"https://github.com/coatless-r-n-d/webr-in-pkgdown","commit_stats":null,"previous_names":["coatless-r-n-d/webr-in-pkgdown"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/coatless-r-n-d/webr-in-pkgdown","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coatless-r-n-d%2Fwebr-in-pkgdown","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coatless-r-n-d%2Fwebr-in-pkgdown/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coatless-r-n-d%2Fwebr-in-pkgdown/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coatless-r-n-d%2Fwebr-in-pkgdown/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coatless-r-n-d","download_url":"https://codeload.github.com/coatless-r-n-d/webr-in-pkgdown/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coatless-r-n-d%2Fwebr-in-pkgdown/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33082701,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-15T20:25:35.270Z","status":"ssl_error","status_checked_at":"2026-05-15T20:25:34.732Z","response_time":103,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["interactive-documentation","pkgdown","r-package-development","r-programming","rstats","wasm","webr"],"created_at":"2025-07-25T03:23:24.779Z","updated_at":"2026-05-15T23:01:49.450Z","avatar_url":"https://github.com/coatless-r-n-d.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n\n# WebR in pkgdown Documentation Website\n\n\u003c!-- badges: start --\u003e\n[![R-CMD-check](https://github.com/coatless-r-n-d/webr-in-pkgdown/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/coatless-r-n-d/webr-in-pkgdown/actions/workflows/R-CMD-check.yaml)\n[![R Wasm \u0026 pkgdown deploy](https://github.com/coatless-r-n-d/webr-in-pkgdown/actions/workflows/rwasm-binary-and-pkgdown-site.yml/badge.svg)](https://github.com/coatless-r-n-d/webr-in-pkgdown/actions/workflows/rwasm-binary-and-pkgdown-site.yml)\n\u003c!-- badges: end --\u003e\n\n\u003e [!NOTE]\n\u003e\n\u003e This repository is still a **work in progress (WIP)**. The documentation and \n\u003e examples are subject to change as we refine the integration of webR with pkgdown.\n\nThis repository demonstrates how to create interactive R documentation by \ncombining [pkgdown](https://pkgdown.r-lib.org/) with \n[webR](https://docs.r-wasm.org/webr/latest/) (WebAssembly Distribution of R). \nThe approach enables users to run R code directly in their browser within the \ndocumentation website, removing the need for local R installation while\nexploring package functionality.\n\n## Live Demo\n\nVisit the [live documentation website](https://rd.thecoatlessprofessor.com/webr-in-pkgdown)\nto see interactive R code in action. The site includes interactive examples for:\n\n- [`in_webr()`](https://rd.thecoatlessprofessor.com/webr-in-pkgdown/reference/in_webr.html):\n  Detect if R is running in WebAssembly\n- [`residual_surrealism`](https://rd.thecoatlessprofessor.com/webr-in-pkgdown/reference/residual_surrealism.html): \n  Interactive data visualization with surreal residuals\n\n## Installation\n\nYou can install the package directly from GitHub using the `remotes` package:\n\n```r\n# install.packages(\"remotes\")\nremotes::install_github(\"coatless-r-n-d/webr-in-pkgdown\")\n```\n\nThen, load the package:\n\n```r\nlibrary(pkgdownwebrdemo)\n```\n\n## Implementation Overview\n\nThe integration combines standard R package development with WebAssembly\ncompilation and automated deployment. WebR is a distribution of R compiled \nfor web browsers using WebAssembly technology. Unlike standard R packages, \nwebR packages require compilation into WebAssembly binaries using the \n[`rwasm`](https://github.com/r-wasm/rwasm) package.\n\nThis repository uses the [`r-wasm/actions`](https://github.com/r-wasm/actions)\nGitHub Action to automate the WebAssembly compilation process. The workflow file\n`.github/workflows/rwasm-binary-and-pkgdown-site.yml` handles documentation \ngeneration, webR binary creation, package repository setup, and deployment to\nGitHub Pages, ensuring that both documentation and webR binaries are available\nat the same domain.\n\n## Implementation Guide\n\nTo implement interactive webR documentation in your own R package, follow\nthe next steps closely. This guide assumes you have a understanding of\nR package development and familiarity with GitHub Actions. \n\n### Step 1: Add the GitHub Actions Workflow\n\nObtain and configure the specialized workflow for building both pkgdown documentation and webR binaries:\n\n```r\nusethis::use_github_action(\n  url = \"https://github.com/r-wasm/actions/blob/main/examples/rwasm-binary-and-pkgdown-site.yml\"\n)\n```\n\nThis workflow was developed through collaborative discussion documented in [r-wasm/actions#15](https://github.com/r-wasm/actions/issues/15).\n\n### Step 2: Configure GitHub Pages\n\nEnable GitHub Pages for your repository:\n\n1. Navigate to your repository's **Settings** tab\n2. Select **Pages** from the sidebar under \"Code and automation\"\n3. Set **Source** to \"GitHub Actions\" \n4. Enable **Enforce HTTPS** in the \"Custom Domain\" settings\n\n![](man/figures/github-repository-settings-for-github-pages.png)\n\n### Step 3: Update Package Documentation\n\nTo enable interactive examples in your package documentation, use the \n`@examplesWebR` tag from [`rocleteer`](https://github.com/coatless-rpkg/rocleteer) \nin your roxygen comments. This tag allows you to specify code that should be \nexecuted in a webR environment.\n\n#### Package Configuration\n\n\u003e [!IMPORTANT]\n\u003e\n\u003e You will need to use a developmental version of `rocleteer`. \n\u003e\n\u003e ```r\n\u003e # install.packages(\"remotes\")\n\u003e remotes::install_github(\"coatless-rpkg/rocleteer\")\n\u003e ```\n\nTo use the `@examplesWebR` tag in your package, include the following in\nyour `DESCRIPTION` file:\n\n```\nSuggests:\n    rocleteer\nRemotes: coatless-rpkg/rocleteer\n\nRoxygen: list(packages = c(\"rocleteer\"))\n```\n\n#### WebR Repository Configuration\n\nConfigure where `rocleteer` should find your webR-compatible package binaries\nby adding into your `DESCRIPTION` file the `Config/rocleteer/webr-repo` field.\n\nYou have two options for specifying the webR repository:\n\n**Option 1: GitHub Pages (recommended for this workflow)**\n\n```\nConfig/rocleteer/webr-repo: https://username.github.io/repository\n```\n\n**Option 2: R-Universe**\n\n```\nConfig/rocleteer/webr-repo: https://username.r-universe.dev\n```\n\nIf not specified, `rocleteer` attempts automatic detection based on the `URL` \nfield in your `DESCRIPTION` file, with a warning if no compatible repository is found.\n\n\n#### Update Documentation\n\nPrepare your package for webR integration:\n\n- **Test locally**: Verify that your standard pkgdown site builds correctly\n  before adding webR functionality\n- **Add interactive examples**: Use `@examplesWebR` tags in your roxygen \n  documentation instead of or alongside standard `@examples`\n- **Update DESCRIPTION file**: Ensure the `Config/rocleteer/webr-repo` field\n  or `URL` field lists your GitHub Pages site (e.g., `https://username.github.io/repository`)\n  or R-Universe account (e.g., `https://username.r-universe.dev`)\n\n### Step 4: Deploy and Verify\n\nAfter pushing your changes:\n\n1. Monitor the GitHub Actions workflow execution\n2. Verify that both jobs (webR compilation and pkgdown building) complete successfully  \n3. Check that your GitHub Pages site displays with interactive code examples functional\n\n## Related Projects and Technologies\n\nThis implementation builds upon several key technologies and projects:\n\n### Core Technologies\n\n- [webR](https://docs.r-wasm.org/webr/latest/) - The WebAssembly distribution of R that enables R execution in browsers\n- [pkgdown](https://pkgdown.r-lib.org/) - R package documentation website generator\n\n### Extensions and Tools\n\n- [`{rwasm}`](https://github.com/r-wasm/rwasm) - Package for compiling R packages to WebAssembly\n- [`{quarto-live}`](https://github.com/r-wasm/quarto-live) - Posit's official Quarto extension for live R and Python code execution in web browsers\n- [`{altdoc}`](https://altdoc.etiennebacher.com/) - Alternative documentation generation tools for R packages\n- [`{quarto-webr}`](https://github.com/coatless/quarto-webr/) - Community\n  Quarto extension that provides webR integration for Quarto documents\n- [`{quarto-panelize}`](https://github.com/coatless-quarto/panelize) - Quarto \n  extension for creating tabset panels with rendered and interactive content.\n\n### Related Demonstrations\n\n- [`quarto-webr-in-altdocs`](https://github.com/coatless-r-n-d/quarto-webr-in-altdocs) - Integration of webR with altdoc-generated documentation using community Quarto extensions\n\n## Contributing\n\nContributions to improve this demonstration are welcome. Please feel free to \nsubmit issues for questions or suggestions, and pull requests for enhancements.\n\n## Acknowledgments\n\nThis work builds on contributions from:\n\n- The [webR development team](https://github.com/r-wasm/webr) for creating the WebAssembly distribution of R\n- The broader R community for ongoing innovation in package documentation and accessibility\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoatless-r-n-d%2Fwebr-in-pkgdown","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoatless-r-n-d%2Fwebr-in-pkgdown","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoatless-r-n-d%2Fwebr-in-pkgdown/lists"}