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

Support wasm-pack frontend in mdBook #1501

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

titaneric
Copy link

@titaneric titaneric commented Apr 15, 2021

This PR aim to solve #1500.

Change of code

  • Add new run_wasm_pack_code function in theme/book.js to fetch wasm-pack results and rendering them in Iframe
  • Support wasm className in theme/book.js to differentiate the normal Rust and Wasm code
  • Add new theme/iframe.html and theme/wasm-entry.mjs for Iframe
  • Move iframe.html and wasm-entry.mjs to built directory by Rust

Note

Demo

2021-04-15.11-29-30.mp4

P.S.

This implementation is more like prototype than production, feel free to point out where I could do better or rewrite suitibly.

@titaneric titaneric marked this pull request as draft April 15, 2021 05:10
@titaneric titaneric force-pushed the feature/wasm-pack-support branch from 85bbf32 to 414ad34 Compare April 15, 2021 05:59
@titaneric titaneric force-pushed the feature/wasm-pack-support branch from 414ad34 to e43b231 Compare April 15, 2021 06:18
@titaneric
Copy link
Author

Hi, I have already served my own rust-playground with wasm-pack feature, perhaps it's ready to be reviewed now.

@titaneric titaneric marked this pull request as ready for review September 20, 2021 10:50
@ehuss
Copy link
Contributor

ehuss commented Sep 20, 2021

Sorry, I'm maybe a little confused on what this is doing. Has the corresponding PR been accepted by integer32? Have they committed to allowing that endpoint to be used by public tools? I probably won't review until they commit to it. If you're proposing to use a new service, I unfortunately probably won't accept that. I think I would prefer making the backend more configurable (#350), so that books can define their own (maybe through some kind of theme files?), but that would need some design work.

@titaneric
Copy link
Author

Yes, #350 would be the better solution when it comes to plenty of available backends.
I do propose a new service to let user to try wasm-pack on the mdBook, and the real backend in rust-playground is still under PR and haven't been reviewed yet. Perhaps I could try #350 first and let someone could use my own service.
Thanks for your comment and I may closed it until #350 is been implemented.

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