Support for URI-based sketch loading in the Web Editor #3422
Labels
Feature Request
Proposal for adding a new functionality
Needs Discussion
Requires further conversation or consensus
Uh oh!
There was an error while loading. Please reload this page.
Increasing Access
This feature reduces friction and helps more people (especially newcomers) get started with code faster.
Feature request details
I’d like to suggest considering support for a subset of the URI schema, which was introduced by @Stefterv in Processing 4.4. It will soon be used to open the processing.org examples directly in the PDE—you can see it in action in this PR (edit: I posted a video in a reply below)
Bringing a similar schema to the p5.js editor would allow users and external tools to open sketches and code snippets in the Web Editor using links that encode the content. This would improve integration with tutorials, documentation, forum posts, educational platforms, and other third-party tools or code generators.
Since the web editor supports mobile coding, you could even fit a p5 sketch in a QR code ✨
Suggested implementation
We could use a
?pde=
query parameter that mirrors the existingpde://
path structure. For example:https://editor.p5js.org/?pde=sketch/base64/<encoded sketch code>
https://editor.p5js.org/?pde=sketch/url/github.com/user/repo/path/to/sketch.js
https://editor.p5js.org/?pde=preferences?theme=dark
See the schema specifications in SCHEMA.md for more details and examples.
Benefits
Supporting a
?pde=
parameter in the p5.js Web Editor would enable new ways of sharing and embedding sketches without requiring them to be saved to a user account. This could be especially helpful for:Note
In many cases, linking to an existing p5.js Web Editor sketch is still the better option; especially if you plan to update or maintain the sketch from your editor account after sharing it. The proposed feature is meant for cases where the sketch doesn’t already exist on the platform or doesn't need to be saved there.
Limitations
Would love to hear thoughts or questions from the team. Happy to help explore a proof of concept if helpful.
The text was updated successfully, but these errors were encountered: