rhaiscript / playground

A Rhai scripting playground that runs Rhai scripts using WebAssembly in a web browser.
https://rhai.rs/playground
MIT License
19 stars 5 forks source link

Support loading GitHub gist files #24

Open Kerollmops opened 5 days ago

Kerollmops commented 5 days ago

Hey 👋

Would it be possible to support loading the content from a GitHub gist like the Rust playground? Not necessarily being able to edit and save the content to a new gist or anything but simply being able to specify the gist we want to load when we load the page.

Have a nice day 🐑

alvinhochun commented 5 days ago

It seems that getting the contents of a gist is quite simple, doesn't require an API token and cross-origin seems allowed, so it is likely doable from client side JS. Overriding the initial code can be easily done in playground.vue, though we probably need a loading screen for it. If anyone is interested, feel free to implement it and make a PR.