Shared lexicon schemas for long-form publishing on AT Protocol. Uses typescript to json via prototypey.

Suggested Lexicon: `site.standard.code.sandbox|pen` #6

Open mrpowershell.com
Open opened by mrpowershell.com

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:

  1. HTML
  2. CSS
  3. JavaScript
  4. An Optional Import Map (JSON)

A less canonical example might consist of:

  1. An arbitrary language
  2. 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)

Sign up or Sign in to add to the discussion.