Skip to content

@examplesWebr tag #1

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

Merged
merged 8 commits into from
Jul 9, 2025
Merged

@examplesWebr tag #1

merged 8 commits into from
Jul 9, 2025

Conversation

coatless
Copy link
Contributor

@coatless coatless commented Jul 8, 2025

Automatically encodes the usual @examples content for use with webR's REPL (https://webr.r-wasm.org).

Important

Requires v0.5.4 or later of webR for the "Share" option to be added.

We'll need to use the pkgdown + webR GitHub workflow I created awhile back:

https://github.com/r-wasm/actions/blob/main/examples/rwasm-binary-and-pkgdown-site.yml

c.f. r-wasm/actions#17

Important

Still need to figure out the "development" R WASM Binary install. Something like
DESCRIPTION file:

WebRRepository: https://user.github.io/pkgname

Or:

Roxygen: list(rocleteer_webr_repo = "https://user.github.io/pkgname/")

This will then go to:

webr::install("pkgname", repos = "https://user.github.io/pkgname/")

Then, we have:

library("pkgname")

c.f. r-lib/roxygen2#1716

@mpadge
Copy link

mpadge commented Jul 8, 2025

@coatless It seems that roxygen2 just uses standard read.dcf stuff to get roclet names. Given that, I'd just add an arbitrary additional field, rather than specify via roclet.

@coatless
Copy link
Contributor Author

coatless commented Jul 8, 2025

My only worry is that by directly using 'read.dcf()' I'll be slowing documentation processing since the function will need to be called each time @examplesWebR is visited for a global option. (File ops expense?)

@mpadge
Copy link

mpadge commented Jul 8, 2025

My only worry is that by directly using 'read.dcf()' I'll be slowing documentation processing since the function will need to be called each time @examplesWebR is visited for a global option. (File ops expense?)

Hmm, yeah right. memoise?

coatless added 5 commits July 8, 2025 13:51
checking Rd files ... WARNING
  demo_fun2.Rd:14-19: Must contain verbatim text
  problem found in ‘demo_fun2.Rd’

This was due to `%` being found in the `\out{}` component unescaped. (We're escaping encoding above.)
Build global options into the workflow.

Incorporate in new features from the webR REPL release (mode & autorun).
@coatless
Copy link
Contributor Author

coatless commented Jul 9, 2025

From @mpadge on rOpenSci Slack:

My only real guide was and remains https://roxygen2.r-lib.org/reference/roclet.html. It seems what you need is initial evaluation via roclet_preprocess which knows nothing of webR URL, then extraction from DESC, and eventual use of URL and block evaluation in roclet_process. That's the flow of srr, because process also does loads of complex things including grabbing external objects for validation which are clearly out of the scope of pre_process / tag_parse.

Example: https://github.com/ropensci-review-tools/srr/blob/main/R/roclet.R

I'm going to try to tackle this in another PR later this week. This will be more involved to change the underlying parsing mechanics. If anything, I think a new article on roclets is in order.

@coatless coatless merged commit 7580cf2 into main Jul 9, 2025
2 checks passed
@mpadge
Copy link

mpadge commented Jul 9, 2025

If anything, I think a new article on roclets is in order.

It is ever 😲 I was really aware of that during srr dev, but had too many other priorities. I wanted to do it by way of example, and so created some thoughts-for-posterity in https://github.com/mpadge/ghrx. I'd be very happy to help make this happen - let me know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants