Another standard want for many sites is a code sandbox, or code pen.
code.sample is a non-interactive sample of code for any single language.
code.sandbox would be an interactive sample of code for any group of languages.
A canonically simple case would be creating a code pen of our own, with:
- HTML
- CSS
- JavaScript
- An Optional Import Map (JSON)
A less canonical example might consist of:
- An arbitrary language
- A sandbox service URL
In order to encompass both scenarios, I suggest the following lexicon:
site.standard.code.sandbox#
A code sandbox. Code sandboxes can contain multiple languages and should be able to run interactively where possible.
| Property | Type | Description |
|---|---|---|
$type |
[string] |
The type of the object. Must be site.standard.code.sandbox. |
title |
[string] |
The title of the sandbox |
sandbox |
[object] |
An object containing code to run in the sandbox. Should contain html, css, javascript, and/or an import map. |
sandboxUrl |
[uri] |
A url for a sandbox service, or a url to the sandbox. If sandbox is empty, this should be treated as an external link |
createdAt |
[datetime] |
The time the sandbox was created |
In case anyone is wondering, I'm suggesting sandbox be optional so that a sandboxUrl can just point to an existing sandbox (thus enabling people to easily link existing sandboxes like codepen)