rust-lang / rust-lang/rust-playground
Idea: Loading large code snippets from arbitrary urls
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.4k
- Forks
- 267
- Avg merge
- 3h 2m
- Merged PRs (30d)
- 6
Description
First, some context: I'm writing a blog post on which I want to provide playground links for all code snippets. Using gist.github.com for this sort of use case would be very annoying to keep up to date when I change the snippets. I have been successfully using urls with embedded code, but finally hit 414 Request-URI Too Large with this snippet.
My first thought on a way to support this usecase was extending play.rust-lang.org to load code from arbitrary urls instead of only supporting gist.github.com. For example it could take a link like
https://play.rust-lang.org/?version=nightly&edition=2018&file=https%3A%2F%2Fnemo157.com%2Ffoo.rs
and load the specified file client-side.
As far as I can tell there should be no additional security issues with this. The code would just be performing a fetch for the file and loading the content into the text box, any potential attack would be the same as when it's loading from a gist.
I'm willing to implement this, just wanted to get feedback on whether you'd accept this approach/have other ideas on a way to support my usecase before spending time on it.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue does not name files or tests; start by locating the existing client-side gist loading path and its URL parsing. The requested behavior is to fetch code from an arbitrary URL and load it into the playground text box, while confirming the proposed approach is acceptable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100