A ‘Quarto’ site rendered with the
carmar filter keeps every page exactly as rendered, and
gives each visible R chunk a Run button that evaluates the chunk on the
reader’s own computer, in the reader’s own R. No server runs the code;
the page talks to a small local process - a CarmaR kernel - over a
loopback socket. This vignette is the author’s story, then the
reader’s.
A report rendered years ago by R Markdown, a bookdown
_book/, a pkgdown article: none of them needs rendering
again. One tag before </head> loads the runtime,
which gives every R block a Run button and the strip at the top:
carmar::make_runnable("report.html") # one file
carmar::make_runnable("_book") # every .html under a folder, onceBy default the page loads the runtime from CarmaR’s published copy;
pass assets = "local" to copy the two files beside the
pages instead. The tag is inserted once; calling it again changes
nothing.
A reader can make a page runnable that its author never touched: a bookmark whose address is the one-line script at https://lacarm.com/carmar/ injects the runtime on click. The kernel treats the site like any other — approved once per session in the consent tab, code run only on Run — so no author cooperation is needed, only a site whose Content-Security-Policy allows the script.
The reader needs R and this package:
listen() starts a headless kernel on the page’s port and
approves that one site - scheme and host, nothing more - for the
kernel’s lifetime. It prints one line:
CarmaR is listening on port 4747 for https://book.example - open the page and press Run.
Then the reader opens the page and presses Run. The chunk’s output appears under the chunk, from their own R, with their own packages and files.
If listen() is called without a site, the page’s first
Run opens a local consent page naming the site, and the reader approves
it there. Either way a site is never trusted because it asked: approval
is per exact origin, per kernel, and ends when the kernel stops. The
browser may also ask, once, for permission for the site to reach the
local network; that is the browser’s own question, and answering yes
lets the page reach 127.0.0.1 and nothing else.
This is execution, not a sandbox. What a reader runs has the same access as their own R console, so authors keep the code visible and readers read a chunk before running it.
To see and stop what is running: