Skip to content

Idea: Loading large code snippets from arbitrary urls #439

Open
@Nemo157

Description

@Nemo157

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementSomething new the playground could dohelp wantedNot immediately going to be prioritized — ask for mentoring instructions!question

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions