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

quarto in the browser #263

Open
thomasballinger opened this issue Jan 16, 2022 · 5 comments
Open

quarto in the browser #263

thomasballinger opened this issue Jan 16, 2022 · 5 comments
Labels
enhancement New feature or request
Milestone

Comments

@thomasballinger
Copy link
Contributor

thomasballinger commented Jan 16, 2022

It'd be neat to run Quarto in the browser, I'm wondering if this is a design goal or perhaps if it's explicitly not. I just found some notes I wrote up a few months ago about various quarto-cli deps:

Deno

It's a goal of Deno to be browser-compatible.

  • any reference to the global Deno namespace would need not to be used?
  • maybe something like denopack is supposed to be used?

esbuild is probably the way to go here? And factoring stuff out?

Pandoc

There's an Asterius-built pandoc executable available at https://asterius.netlify.app/demo/pandoc/pandoc.html but I haven't found the code that builds it.

There's an old GHCJS-compiled pandoc too.

It's not clear that either of these keep the lua functionality intact? There's been lots of back and forth trying to get the C bits out of pandoc, but currently there are C dependencies. The lua filters seem to be integral to Quarto. There are definitely Emscripten builds of Lua out there, but the integration might be tricky.

ESBuild

Is this maybe a runtime dependency? there's a wasm version available at esbuild-wasm on npm, see https://esbuild.github.io/getting-started/#wasm

SASS

There's a version of SASS compiled to JavaScript on npm.

R

I heard from Pyodide folks that discussions of compiling R to the browser petered out because there was so much Fortran involved. It seems like R isn't required to run to run Quarto at all, but I want to check because when commands like quarto serve error on my if I don't have Shiny R library installed, suggesting there's some R in there somewhere. edit: I misunderstood what quarto serve does, it's explicitly for Shiny apps.

@jjallaire
Copy link
Collaborator

Yes, we would definitely like to run Quarto in the browser! You are correct that R is not required for Quarto so that's not a gating factor.

I think Pandoc is going to be the long pole here. You are correct that we make extensive use of Lua filters. Even though getting C dependencies out has been a consideration I don't think this is an overriding concern (as the pandoc.List Lua object was re-written in C for performance just this past release).

@thomasballinger
Copy link
Contributor Author

Great to hear! Yeah I'm worried getting a Pandoc build with lua support will require getting deep into emscripten and one of the Haskell to WebAssembly toolchains to do the linking. A project I'm not going to tackle now, but I'll keep an eye on that world.

@thomasballinger
Copy link
Contributor Author

Working with Tweag might be a way to do this, Asterious has a demo compiling pandoc but no source available (and I assume without lua filters working).

@thomasballinger
Copy link
Contributor Author

As stated above this isn't a blocker, but sounds like there are efforts to get R in the browser, it's not stuck like I said above: https://github.com/georgestagg/webR & see https://chrz.de/2020/04/21/fortran-in-the-browser for info about how to get FORTRAN in (h/t @mdboom)

@thomasballinger
Copy link
Contributor Author

Cheng Shao and Tweag, the consultancy they're affiliated with, are working to add WebAssembly support to ghc: https://asterius.netlify.app/milestones-2022-01.html

But they say

hslua support is another story, since I'm not familiar with lua internals, so I'm not sure if the c toolchain we use is sufficient to support it.

Sounds like it makes sense to wait for the out-of-the-box pandoc support that a WebAssembly-capable ghc promises, but figuring out the lua story may be extra work.

@jjallaire jjallaire added this to the Future milestone Jun 9, 2022
@mcanouil mcanouil added the enhancement New feature or request label Jul 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants