On this page
  1. 0. Purpose and Principles
  2. 1. Terminology
  3. 2. Bundle
  4. 3. Manifest
  5. 4. Signature
  6. 5. Lessons
  7. 6. Block Directives
  8. 7. Widgets
  9. 8. Security Requirements for Players and Validators
  10. 9. Internationalisation (optional)
  11. 10. Versioning and Compatibility
  12. 11. Validator Conformance
  13. 12. Minimal Example
  14. 13. Open Items (post-1.0)
  15. Changelog

Format specification

Course Format Specification

Version: 1.0.0-rc.9
Status: Release candidate. The format is frozen: no breaking changes before 1.0.0 final. Additions during the rc period are limited to optional fields that an older player can ignore safely. Report ambiguities and gaps against this document.


0. Purpose and Principles

This document specifies the portable course format used by the platform player. A course is a self-contained, signed archive that can be rendered fully offline on iOS, Android, desktop and web.

Who this is for. People implementing a player, a validator or authoring tools, and authors looking up a specific field. It is a reference, not a tutorial: an author writing their first course should read AUTHORING.md instead and come here only for §7.3. Nothing in this document is knowledge an author needs in order to write a course — the tooling applies these rules on their behalf.

Design principles, in priority order:

  1. Safety. A course can never execute author-supplied code on the learner's device. All interactivity is declarative.
  2. Longevity. A course valid under any released version of this spec MUST remain openable by all future players.
  3. Portability. No external dependencies at runtime: no network, no remote fonts, no CDN scripts.
  4. Authorability. Courses can be written in a plain text editor and validated with a CLI.

The key words MUST, MUST NOT, SHOULD, SHOULD NOT and MAY are to be interpreted as in RFC 2119.


1. Terminology

Term Meaning
Bundle The .course archive containing a complete course
Manifest manifest.json at the bundle root
Lesson A single Markdown document
Chapter An ordered group of lessons
Block A fenced ::: directive inside a lesson (callout, video, widget, …)
Widget An interactive block rendered by a player-provided component
Player The application that opens and renders bundles
Validator The reference tool that checks a source directory against this spec
Signer The platform service that signs approved bundles

2. Bundle

2.1 Container

A bundle is a ZIP archive (PKZIP 2.0, DEFLATE or STORE) with the extension .course.

2.2 Layout

/
├── manifest.json        REQUIRED
├── signature.json       REQUIRED in distributed bundles (absent in unsigned dev builds)
├── lessons/             REQUIRED — one or more .md files
├── assets/              OPTIONAL
│   ├── images/
│   ├── video/
│   ├── audio/
│   └── animations/
├── widgets/             RESERVED — for shared widget definitions; not used in 1.0
└── i18n/                OPTIONAL — translation files

Any additional top-level entries MUST be ignored by the player and SHOULD be flagged by the validator.

Source form. The layout above is the bundle. A course is normally written in a directory that differs in two ways, and a build step produces the bundle from it:

In the source directory In the bundle
manifest.json.in — hand-written, contentHashes left as {} manifest.json — generated, contentHashes filled in
no signature.json signature.json, added by signing (§4)

A tool MAY use different names, but SHOULD NOT require an author to maintain contentHashes by hand: they change on every edit, and a stale one is indistinguishable from tampering. tome build implements this; §11 conformance applies to the bundle, not to the source directory.

Signing is not the author's step. An author without platform keys ships an unsigned bundle — valid in every respect except that it lacks signature.json — and the platform signs it after review (§4). A player MAY open an unsigned bundle in a developer mode; it MUST NOT do so in the ordinary library.

2.3 Asset constraints

Kind Allowed formats Limits
Image PNG, JPEG, WebP, SVG (sanitised, see §8.3) ≤ 10 MiB each; ≤ 8192 px per side
Video MP4 container, H.264 video, AAC audio ≤ 500 MiB each; ≤ 1080p
Audio MP3, AAC (M4A), Opus in OGG ≤ 50 MiB each. Also used for instrument samples (§7.9)
Animation Lottie JSON (v5.x schema) ≤ 5 MiB; MUST NOT contain expressions
Font not allowed Player supplies all fonts

hotspot regions are defined in percentages of the image box (§7.3), so a low-resolution image goes blurry long before the coordinates stop working: prefer SVG, or a 2× raster.

Validators MUST reject assets outside these constraints. The signer MAY transcode media to conforming formats.

There is no limit on the total size of a course. Every asset is downloaded once per device and kept, so size is a cost to the learner's storage and first download rather than to every visit; tome validate reports the total.


3. Manifest

manifest.json MUST be a UTF-8 JSON object conforming to the schema below.

3.1 Schema

The normative machine-readable schemas are schemas/manifest.schema.json and schemas/widget.schema.json, distributed with this document (JSON Schema draft 2020-12). Where this prose and the schema disagree, the schema is normative for structure and the prose is normative for meaning. tome validate runs exactly these files.

A manifest MAY carry a $schema key pointing at manifest.schema.json. It is ignored by players and validators, and exists so an author's editor can offer completion and inline errors.

The annotated example below is informal, for reading:

{
  "formatVersion": "1.0.0-rc.9",            // REQUIRED, semver, this spec's version
  "id": "com.example.linear-algebra-101",   // REQUIRED, reverse-DNS style, immutable for the life of the course
  "version": "1.3.0",                       // REQUIRED, semver of the course content
  "title": "Linear Algebra, Visually",      // REQUIRED, ≤ 120 chars
  "subtitle": "From arrows to eigenvalues", // OPTIONAL, ≤ 200 chars
  "description": "…",                       // REQUIRED, plain text or limited Markdown, ≤ 4000 chars
  "language": "en",                         // REQUIRED, BCP 47
  "authors": [                              // REQUIRED, ≥ 1
    { "name": "Jane Doe", "id": "author_8f2k" }
  ],
  "tags": ["math", "linear-algebra"],       // OPTIONAL, ≤ 10, lowercase kebab-case
  "level": "beginner",                      // OPTIONAL: beginner | intermediate | advanced
  "estimatedMinutes": 240,                  // OPTIONAL, integer
  "cover": "assets/images/cover.webp",      // REQUIRED, image, 3:4 aspect recommended
  "minPlayerVersion": "1.0.0",              // OPTIONAL, semver; player MUST refuse if older
  "structure": [                            // REQUIRED, ordered chapters
    {
      "id": "ch1",                          // REQUIRED, unique within manifest, ^[a-z0-9-]+$
      "title": "Vectors",                   // REQUIRED
      "lessons": [                          // REQUIRED, ordered paths into lessons/
        "lessons/01-intro.md",
        "lessons/02-vectors.md"
      ]
    }
  ],
  "contentHashes": {                        // REQUIRED, every file except manifest.json and signature.json
    "lessons/01-intro.md": "sha256:003a9be454c8dfac7dcec69357c6c0af118a8d6059c85dcd410d1a290711e7f0",
    "assets/images/cover.webp": "sha256:a7c537dca46cdc697736f6a79f632f62cf91fcc7fe78a600668d98166aa5bb98"
  },
  "bestOn": ["tablet", "desktop"],          // OPTIONAL: subset of phone | tablet | desktop. Informative hint, nothing is blocked
  "uses": ["microphone", "drawing"],        // OPTIONAL: device capabilities the course uses: microphone | drawing | audio (see §3.2)
  "accessibility": { "audioWithoutTranscript": false }, // OPTIONAL, see §9
  "license": "all-rights-reserved",         // OPTIONAL: SPDX id or "all-rights-reserved" (default)
  "assetsByAuthor": true,                   // OPTIONAL: every image, audio and video asset is the authors'
                                            // own work. Default false — see §3.3
  "credits": [                              // OPTIONAL: attribution per asset, see §3.3
    {
      "asset": "assets/images/mitosis.jpg", // REQUIRED, path within the bundle
      "title": "Onion root tip mitosis",    // OPTIONAL
      "creator": "A. Photographer",         // REQUIRED
      "source": "https://example.org/x",    // OPTIONAL, informative: never fetched
      "license": "CC BY-SA 4.0",            // OPTIONAL, SPDX id or a licence name
      "modified": "Cropped and relabelled"  // OPTIONAL
    }
  ],
  "changelog": "Fixed typos in chapter 2.", // OPTIONAL, shown to learners on update
}

3.2 Rules

3.3 Asset credit

Attribution is a legal and an ethical requirement, and a course that cannot be checked for it cannot be reviewed before sale. So the format makes authorship explicit rather than assumed:

A validator MUST report an uncredited asset (§11). It cannot know who made a picture — only that the author has not said.


4. Signature

signature.json:

{
  "algorithm": "Ed25519",
  "keyId": "platform-2026-01",
  "signedAt": "2026-08-20T12:00:00Z",
  "manifestHash": "sha256:…",
  "signature": "base64…",
  "publicKey": "3c9319c1…"     // OPTIONAL, hex: the signer's public key (see below)
}

5. Lessons

5.1 Encoding and front matter

Lessons are UTF-8 Markdown files. They MAY begin with a YAML front-matter block:

---
title: Vectors as Arrows
estimatedMinutes: 12
---
Field Required Notes
title yes Displayed in navigation
estimatedMinutes no
summary no ≤ 300 chars

5.2 Supported Markdown

Base syntax is CommonMark 0.31 plus the following GFM extensions:

Parsing order. Math spans (§5.4) and inline code are recognised before table cell splitting, so a | inside $…$ or backticks does not start a new cell. Authors who need to be safe with other tools MAY use \lvert … \rvert instead of | in math.

5.3 Explicitly unsupported / forbidden

Validators MUST reject lessons containing:

5.4 Math

5.5 Images, video, audio

Images use standard Markdown syntax with a relative path:

![A vector drawn from the origin](assets/images/vector-arrow.webp)

Alt text is REQUIRED for accessibility (validator error if missing).

Video and audio use block directives (§6):

:::video src="assets/video/intro.mp4" poster="assets/images/intro-poster.webp"
Optional caption in Markdown.
:::

Attributes: src (required), poster (image, optional), captions (WebVTT file path, optional), autoplay (MUST be ignored if audio track present). Players MUST NOT autoplay with sound.

Validators MUST check that targets exist.


6. Block Directives

Directives use the fenced ::: syntax (compatible with the remark-directive / "generic directives" proposal).

:::name key="value" key2=123
(optional Markdown or JSON body)
:::

Rules:

6.1 Built-in directives

Name Body Purpose
note, tip, warning, important Markdown Callout boxes. Optional title attribute.
video, audio Markdown caption See §5.5
lottie — src attribute. Attributes loop (bool, default true), autoplay (bool, default true)
figure Markdown caption Wraps an image with a numbered caption. Optional credit attribute (inline Markdown) shown under the caption — the shorthand for a one-off attribution, equivalent to a credits entry (§3.3)
details Markdown Collapsible section. summary attribute required. Also the idiomatic way to give a lesson-level hint: :::details summary="Hint"
checkpoint Markdown (optional message) Progress gate; lesson marked complete only after all checkpoints are passed (§7.4)
widget YAML/JSON Interactive widget, see §7
columns Markdown containing ::: column children Side-by-side layout; players MAY collapse to single column on narrow screens
listening Markdown containing widgets and an optional :::transcript A listening group: one clip shared by several widgets, see §6.2
transcript Markdown Only valid inside listening. Dialogue: single newlines are rendered as line breaks

6.2 Listening groups

"Listen, then answer several questions" is the core exercise of every language course. A listening group gives the questions one clip, one play limit and one transcript:

::::listening src="assets/audio/dialogo-1.mp3" playLimit=2 speed="0.75,1"
:::transcript
— Buenos días, ¿qué desea?
— Un café con leche, por favor.
:::

:::widget type="multiple-choice" id="q1"
prompt: What does the customer order?
options:
  - text: A tea
  - text: A coffee with milk
    correct: true
  - text: An orange juice
:::

:::widget type="fill-blank" id="q2"
text: "The customer says *por {{favor}}* at the end."
:::
::::

Attributes: src (required, audio asset), playLimit (integer ≥ 1, optional), speed (comma-separated playback rates, optional). These are the scalar form of the Media object (§7.7).

Rules:


7. Widgets

A widget is a :::widget directive whose body is a YAML (or JSON) object.

:::widget type="multiple-choice" id="q-dot-1"
prompt: What is $\vec a \cdot \vec b$ when the vectors are perpendicular?
options:
  - text: "0"
    correct: true
    explanation: Perpendicular vectors have zero projection onto each other.
  - text: "1"
  - text: $|\vec a||\vec b|$
    explanation: That is the maximum, reached when they are parallel.
shuffle: true
:::

Backslashes need no escaping in YAML plain scalars, which is why YAML is recommended for TeX-heavy and code-heavy widgets. Two YAML rules to remember:

The validator reports unexpected keys, which is the usual symptom of an unquoted comma.

7.1 Common attributes

Attribute Required Notes
type yes One of the registered types (§7.3)
id yes ^[a-z0-9-]+$, unique within the course. Learner state is keyed on (courseId, widgetId) — keep stable across versions
ref — Reserved. Shared widget bodies in widgets/ were specified before any player implemented them; validators MUST reject ref in 1.0. Write the body inline
required no If true, the widget must be completed to pass the next checkpoint. Default true for graded widgets, false for exploratory ones
audio no Media (§7.7): a clip with its own player shown above the prompt. Allowed on every widget that has a prompt, and on fill-blank. For several questions about one clip use a listening group (§6.2) instead

Graded widgets — every type that grades (§7.4) also accepts these, defined here rather than repeated in each entry of §7.3. In the schema they are the graded base; a type that does not grade MUST reject them.

Attribute Required Notes
hint no Inline Markdown, shown after the first wrong attempt
explanation no Inline Markdown, shown on success and with a revealed solution — never after a wrong answer while the learner can still try, since it would give the answer away. A player MAY keep it behind a disclosure under the verdict (the reference player's "Why?"), but MUST make it reachable from the success state, including on a later visit. This is where the teaching goes — an empty explanation wastes the moment the learner is most receptive
maxAttempts — Reserved; validators MUST reject it. Its only meaning — locking an exercise after N tries — would block a checkpoint forever in a course with no teacher to unlock it. solutionAfterAttempts is the humane way to end a struggle
solutionAfterAttempts no Integer. After this many failures the player offers the answer. Default 3; -1 never

7.2 Strings inside widget bodies

Two kinds of Markdown strings appear in widget bodies:

Item — wherever the catalogue says Item, the author may write either an inline-Markdown string or an object:

- text: "el pan"              # inline Markdown, required
  audio: assets/audio/pan.mp3 # optional Media

Item replaces plain strings in: ordering.items[], matching.pairs[].left|right, flashcards.cards[].front|back. multiple-choice options keep text as a string and gain a sibling audio field. A player renders the audio as a small play button beside the text. Items are still compared by text for grading; audio never influences grading.

Audio on an Item or option needs no transcript — the text beside it is the transcript. The transcript warning (§7.7) applies to widget-level audio, dictation.audio and record.model only.

7.3 Widget catalogue

Fields marked • are required.

multiple-choice

Field Type Notes
prompt • string
options • array of { text•, correct?, explanation? } 2–8 options; ≥ 1 correct. An option's explanation says why that option is right or wrong: shown after the learner checks an answer that includes it (a wrong option's never names the right one), and for correct options together with the widget explanation
multiple bool Allow several answers (default false)
shuffle bool Default false

Graded. Complete when the learner has submitted a fully correct answer (retries allowed unless maxAttempts is set).

numeric-input

Field Type Notes
prompt • string
answer • number
tolerance number Absolute tolerance, default 0
relativeTolerance number e.g. 0.01 = 1 %
unit string Displayed suffix
hint string Shown after first wrong attempt

Graded.

free-text

Field Type Notes
prompt • string
grading • "self" | "keywords" | "pattern"
keywords array of strings For keywords: all must appear (case-insensitive)
pattern string For pattern: a RE2-compatible regex (no backreferences/lookaround, to prevent catastrophic backtracking)
modelAnswer string Revealed after submission

Graded (self-graded counts as complete on submission).

fill-blank

Field Type Notes
text • string Blanks written as `{{answer
caseSensitive bool Default false; applies to text blanks only

Text blanks are compared after trimming whitespace. Numeric blanks accept any decimal representation within the tolerance (default tolerance 0). Players MUST parse text as inline Markdown before substituting blanks, so emphasis and other inline spans may contain a blank (*¿Algo {{más}}?*).

Graded.

ordering

Field Type Notes
prompt • string
items • array of strings Given in correct order; player shuffles

Graded. Correct order is the order items is written in — the player shuffles the display order and grades against the authored order, by item position, not by comparing text.

matching

Field Type Notes
prompt • string
pairs • array of { left•, right• } 2–10 pairs

Graded. A pair is correct when the learner connects the left item to the right item it is paired with by position in pairs — the player never compares the text of left and right, so two pairs may share identical text on one side without becoming interchangeable.

slider-explore

Field Type Notes
params • array of { name•, min•, max•, step, default, label } Names are identifiers ^[a-zA-Z_][a-zA-Z0-9_]*$. value is accepted as a synonym of default
plot Same shape as the plot widget series (each { expr | points, label?, style? }), x, y, samples, axes, caption. expr is accepted as sugar for a single series. Expressions may reference x and the params (§7.5)
outputs array of { label•, expr•, precision?, suffix? } Live computed values displayed beside the sliders. precision = decimals (default 2); suffix e.g. "°", " m/s"
geometry Scene (see geometry) A 2-D scene whose coordinates may reference the params
caption string

At least one of plot, outputs, geometry is required. Exploratory (not graded).

geometry

A declarative 2-D drawing: points, vectors, segments, circles, polygons and labels on a coordinate plane. All numeric fields are expressions (§7.5), so they MAY reference params — either the widget's own or, when embedded inside slider-explore, that widget's sliders.

Field Type Notes
view • { x•: [min,max], y•: [min,max], grid?, axes?, aspect? } grid/axes booleans (default true); aspect "equal" (default) or "auto"
params as in slider-explore Own sliders (omit when nested in slider-explore)
shapes • array of Shape Drawn in order
caption string

Shape — kind is required; all coordinates are expressions.

kind Fields Notes
point at•: [x,y], label?, bind?: [px, py], color? A point with bind is draggable: dragging writes its coordinates (snapped to each param's step and clamped to its range) into the two named params
vector from?: [x,y] (default origin), to•: [x,y], label?, color?, dashed? Arrow
segment from•, to•, label?, color?, dashed?
line through•: [x,y], direction•: [dx,dy], color?, dashed? Infinite line
circle center•, radius•, color?, fill?
polygon points•: [[x,y],…], color?, fill? Closed
arc center•, radius•, from• (deg), to• (deg), label?, color? For marking angles
text at•, text•, color? text is inline Markdown

color is one of a small named palette (primary, secondary, accent, muted, red, green, blue, orange) so courses look consistent and honour dark mode. fill is a number 0–1 (opacity of the fill).

Exploratory (not graded). Every name in a bind MUST refer to an existing param (the widget's own, or the enclosing slider-explore's). A draggable point and a slider bound to the same param stay in sync.

:::widget type="slider-explore" id="explore-vector"
params:
  - { name: vx, min: -5, max: 5, step: 0.5, default: 3, label: $v_x$ }
  - { name: vy, min: -5, max: 5, step: 0.5, default: 4, label: $v_y$ }
geometry:
  view: { x: [-5, 5], y: [-5, 5] }
  shapes:
    - { kind: vector, to: [vx, vy], label: $\vec v$, color: primary }
    - { kind: segment, from: [0, 0], to: [vx, 0], dashed: true, color: muted }
    - { kind: segment, from: [vx, 0], to: [vx, vy], dashed: true, color: muted }
    - { kind: point, at: [vx, vy], bind: [vx, vy] }   # draggable tip
outputs:
  - { label: Length, expr: sqrt(vx^2 + vy^2) }
:::

plot

Field Type Notes
series • array of { expr?, points?, label?, style? } Either expr (function of x) or points (array of [x,y])
x • [min, max] or { labels: [...] } Numeric range, or a categorical axis: points[][0] is then an index into labels (years, countries, weekdays…)
y [min, max] Auto if omitted
series[].style line | dashed | dots | bars | area Default line
axes { xLabel?, yLabel?, grid? }
caption, source inline Markdown Caption under the chart; source is an attribution line
description string Text alternative, see §7.11

Exploratory.

code-exercise

An in-lesson programming environment: a code editor, an output console, a Run button and a Submit button. See §7.6 for full semantics.

Field Type Notes
language • "python" | "javascript" Players ship a WASM sandbox per language (§8.4). Adding a language requires a player release, not a spec change
prompt • string The assignment, block Markdown (§7.2): may contain code blocks, lists and tables
starterCode string Initial editor contents
files — Reserved for multi-file exercises in a future minor version; validators MUST reject it in 1.0. Use a single starterCode
stdin string Fed to the program on Run (not on Submit — tests control their own input)
grading "tests" | "output" Default "tests"
tests array of Test (below) Required when grading is "tests"
cases array of Case (below) Required when grading is "output"; each case is one stdin/expected-output pair
outputMatch "exact" | "trimmed" | "lines" For "output" grading, see §7.6.3. Default "trimmed"
solution string Reference solution
solutionAfterAttempts integer Number of failed submits before "Show solution" appears. Default 3 for "tests", 2 for "output"; 0 = always available; -1 = never
hints array of strings Revealed one at a time, in order, on request
limits { timeoutMs?, memoryMb? } Defaults 5 000 ms / 128 MB; hard-capped by the player at 10 000 ms / 256 MB
resetable bool Show a "Reset to starter code" action. Default true

Test object

Field Type Notes
name • string Shown to the learner in the results list (even for hidden tests, the name is shown; only the code and failure detail are withheld)
code • string Test code in the same language. A test passes if it runs to completion without raising/throwing; it fails otherwise
hidden bool If true, the test's code and failure message are not shown; the learner sees only pass/fail. Default false
stdin string Input provided while this test runs
timeoutMs integer Per-test override, ≤ limits.timeoutMs

Case object (output grading)

Field Type Notes
name string Shown in the results list. Default "Case N"
stdin string Input for this run. Default empty
expectedOutput • string Expected stdout
hidden bool If true, stdin and expected output are not shown on failure. Default false

Graded. Complete when a Submit passes all tests (or all cases, for "output" grading).

flashcards

Field Type Notes
cards • array of { front•, back• } front and back are Items (§7.2)
spaced bool Opt into spaced review, below. Default false: the deck is browsed
shuffle bool Present the cards in a new random order on each visit. Default false

Exploratory: a deck never blocks a checkpoint.

Spaced review. With spaced: true the player presents the deck as a review session rather than a browsable stack: the learner turns a card, then grades their own recall as again, hard or good, and the player schedules when that card returns. Requirements:

The scheduling algorithm is the player's choice. The reference player uses Leitner boxes (1, 3, 7, 16 and 35 days) because a learner can understand them and they recover gracefully from long breaks.

diagram

Reserved, not implemented. A Mermaid subset (flowchart, sequence, class, state) was specified in 0.2 and never built: no sample course needed one — processes were better served by ordering, structures by hotspot — and Mermaid is a large dependency whose HTML-label features would each need locking down under §8.

The type name is reserved so that a future player can add it as a minor version. Until then a validator MUST reject type: diagram, and authors should use figure with an SVG asset.

dictation

Listen and type what you hear.

Field Type Notes
audio • Media The clip. transcriptAfter defaults to complete
answer • string The expected text, plain
alternatives array of strings Other accepted texts (e.g. with/without contraction)
prompt block Markdown Optional framing ("Write the second sentence only")
ignoreCase bool Default true
ignorePunctuation bool Default true. Strips .,;:!?¿¡"'()-— and collapses whitespace
ignoreAccents bool Default false — accents are meaning-bearing in most target languages. Set true for beginners
hint inline Markdown Shown after the first wrong attempt

Grading. Both the learner's text and each accepted text are normalised per the flags (NFC first, then the flags). The widget is complete when the learner's text equals one of them. On a wrong attempt the player MUST show a word-level diff: matched words, missing words, and extra words, so the learner knows which word to listen for. The expected text itself is not revealed until complete.

Graded.

record

Speak; compare yourself with a model.

Field Type Notes
prompt • block Markdown What to say
model Media A reference recording the learner can play before and after
maxSeconds integer Default 30, max 120
rubric array of inline Markdown Self-check items, e.g. "I pronounced the rr as a trill"
grading "self" The only value in 0.3. Reserved for future pronunciation scoring

Flow. Record → play back (and play the model) → tick the rubric → "Done". Complete when a recording exists and "Done" is pressed; the rubric is not enforced. The recording is stored as a learner attachment (§7.4). Re-recording replaces it.

Without a microphone. If permission is denied or no device exists, the player MUST still let the learner complete the widget by listening to the model and pressing "Done", and SHOULD say why. A course must remain completable on any device.

Graded (self).

sketch

Draw on a canvas.

Field Type Notes
prompt • block Markdown
canvas { width, height } Logical pixels, default 800 × 600, max 2048 per side. The drawing is stored at this resolution regardless of screen size
reference image path Shown beside (or above, on narrow screens) the canvas the whole time — the thing to draw
trace image path Shown faded under the canvas for tracing; the learner can toggle it. Same dimensions as canvas or it is letterboxed
traceOpacity number 0–1 Default 0.3
model image path The instructor's version, revealed after "Done" beside the learner's drawing at the same size (stacked, learner's first, below 860 px)
tools array Subset of pen, eraser, fill. Default [pen, eraser]
palette array of colours CSS hex. Default a 6-colour neutral set. The first is the initial colour
widths array of numbers Stroke widths offered. Default [2, 5, 10]
pressure bool Use stylus pressure for width, default true. Finger and mouse get a constant width
rubric array of inline Markdown Self-check items shown with the model
minStrokes integer "Done" is disabled below this many strokes. Default 1
grading "self" Only value in 0.3

Stored state. A PNG at canvas resolution plus the stroke list ([{ color, width, points: [[x, y, p], …] }]) so a future player can re-render or continue. Both are learner attachments (§7.4).

Tracing is a crutch, deliberately. There is no automatic tracing score. Comparing with the model and the rubric is the feedback loop; the widget is about looking, not matching pixels.

Graded (self).

board

A grid position with a question: find the square, make the move.

Field Type Notes
prompt • block Markdown
rows •, cols • integer 1–19
grid "squares" | "intersections" Pieces sit on squares (chess, checkers) or on line intersections (go). Default squares
theme "checkered" | "plain" | "wood" Default checkered for squares, wood for intersections
coordinates "algebraic" | "none" Algebraic: files a… from the left, ranks 1… from the bottom. Default algebraic
orientation "normal" | "flipped" Flipped shows rank 1 at the top (Black's view)
pieces • array of Piece
answer • Answer See below
marks array of { at, kind } Static highlights: circle, square, arrow (with to). For teaching diagrams
explanation inline Markdown Shown when complete
hint inline Markdown After the first wrong attempt
solutionAfterAttempts integer Default 3; -1 never

Piece — { at•, glyph• | sprite•, color? }. at is algebraic ("e4") or [row, col] zero-based from the top-left. glyph is a single Unicode character (chess: ♔♕♖♗♘♙ ♚♛♜♝♞♟; go: ● ○; checkers: ⛀⛂); sprite is an image asset. color tints the glyph.

The board MUST be operable without a pointer: one tab stop for the whole board, arrow keys to move in screen directions (so a flipped board still behaves naturally), Enter or Space to act on the square. Each square's accessible name MUST include its coordinate and any piece on it.

Answer — one of:

No rules engine: the widget does not know how a knight moves. The author lists the accepted answers; that is what makes one widget cover chess, go, checkers, Sudoku-style "which cell" questions and even "which country on this grid map". Variants of a move that an engine would consider equal (different move orders) must be listed explicitly.

After a correct move the player MUST show the piece on its destination. On a failed squares check the selection is kept so the learner can adjust it.

Graded. Complete on an accepted answer.

score

Display notation; optionally play it; optionally ask a question about it.

Field Type Notes
abc • string Notation, §7.8
prompt block Markdown
play bool Show a play button. Default true
tempo integer 30–240 Playback tempo in bpm; overrides Q:
tempoRange [min, max] Offer a tempo slider between these values
transpose integer −12…12 Render and play transposed by semitones
highlight array of { from, to, label? } Bar ranges (1-based, inclusive) marked in the score, for "look at bars 3–4"
follow bool Highlight each note as it plays. Default true when play
instrument Instrument §7.9
answer Answer Optional; without it the widget is exploratory, not graded
explanation, hint inline Markdown
solutionAfterAttempts integer Default 3; -1 never

Answer — one of:

A score without answer is exploratory: it does not count toward a checkpoint (§7.4).

Graded when answer is present.

keyboard

A piano as an answer surface.

Field Type Notes
prompt • block Markdown
range [low, high] Scientific pitch, default [C4, C6]. At most 3 octaves
labels none | c-only | all Key names printed on the keys. Default c-only
answer • { kind, accept } kind: keys — the set of notes to press (order-free), e.g. ["A4","C5","E5"]. kind: sequence — notes in order, e.g. a scale. accept may list several acceptable sets, each an array
given array of notes Pre-pressed keys shown as context ("here is the root")
showAnswerAs keys | score | both How the solution is revealed. Default keys
octaveTolerant bool Accept the right pitch classes in any octave. Default false
instrument Instrument §7.9
hint, explanation inline Markdown
solutionAfterAttempts integer Default 3

The keyboard MUST be operable without a pointer: one tab stop for the whole instrument, arrow keys to move between keys in pitch order, Enter or Space to press. Each key's accessible name MUST include its pitch and whether it is pressed.

Pressing a key always sounds it, whether or not the answer is right — the point is to connect the name, the position and the sound.

With kind: sequence, the player MUST reject at the first wrong note rather than at the end of the sequence, and say which position failed. Changing tempo (in score) MUST stop playback, or the follow-highlight drifts out of sync with the sound.

Graded.

hotspot

Regions on an image, clicked or labelled.

Field Type Notes
image • image path The diagram or photograph
alt • string Description of the whole image, for screen readers
prompt • block Markdown
regions • array of Region The clickable areas
answer Answer See below. Optional: without it the widget is an annotated image (below)
showLabels never | after | always When region names are drawn on the image. Default after (once complete)
outline always | hover | never When region shapes are visible. Default hover; always suits a labelling exercise, never a "find it" exercise
hint, explanation inline Markdown
solutionAfterAttempts integer Default 3; -1 never

Region — { id•, label•, shape•, at•, description? }

Answer — one of:

Without answer the widget is an annotated image, not an exercise: every region is outlined, and choosing one shows its label on the image and its description below. It is not graded and never blocks a checkpoint. This is the form for detailed source material — a tablet, a manuscript, a map — where the point is to look closely with guidance, not to be tested.

Accessibility: every region MUST be reachable by keyboard as a button named by its label (for kind: label, named by its position in the image using description if given), and the widget MUST expose alt for the image itself. A labelling exercise that can only be completed by dragging with a mouse is not acceptable.

Graded.

table-input

A grid the learner fills in.

Field Type Notes
prompt • block Markdown
columns • array of inline Markdown Column headers
rows array of inline Markdown Row headers. Omit for a table with no row labels
cells • 2-D array of Cell cells[row][col]. Length must match rows × columns
caption inline Markdown Rendered as the table caption
mode type | choose type: free text/number entry. choose: every blank cell offers the same set of options. Default type
options array of strings Required when mode: choose; the palette of allowed values
hint, explanation inline Markdown
solutionAfterAttempts integer Default 3; -1 never

Cell — one of:

Grading is all-or-nothing on Check, but the player MUST mark each cell individually so the learner sees which cells are wrong, and MUST NOT clear correct cells on a failed attempt.

Graded.

molecule

Field Type Notes
smiles string Structure, §7.10. Required unless reaction is given
name inline Markdown Displayed as a caption
prompt block Markdown
reaction string A SMILES reaction (reactants>>products, multiple species separated by .) rendered as an equation instead of a single structure. Exactly one of smiles or reaction is required; a reaction has no clickable atoms
showFormula bool Show the molecular formula under the structure. Default false
highlight array of integers Atom indices marked in the drawing, for "look at this group"
answer Answer Optional; without it the widget is exploratory

Answer — one of:

Every atom MUST be a keyboard-reachable target of at least 24 × 24 CSS px, named by its element and index, exactly as notes are in score (§7.3 score).

Graded when answer is present.

simulation

A model that runs.

Field Type Notes
prompt • block Markdown
state • map of name → number Initial values. Names follow §7.5 identifier rules. t is reserved: the player supplies the model clock
step • map of name → expression Applied every tick. All right-hand sides are evaluated against the previous state, so order does not matter
dt number Model time per tick. Default 0.05. A param named dt overrides it, so the time step can be a slider
params array of Param Sliders the learner can move while it runs: { name•, label, min•, max•, step, value }. default is accepted as a synonym of value, since slider-explore spells it that way; players MUST accept both and authors SHOULD prefer value
stopWhen expression Boolean; the run halts when it becomes true
readouts array of { label•, expr•, precision?, unit? } Live numeric values
trace { x•, series•, y? } Plot state over time. series is a list of { expr•, label? }
scene { viewBox?, shapes• } Shapes whose geometry is bound to expressions, drawn every frame
autoplay bool Default false. Players MUST NOT autoplay a simulation with sound
description string Text alternative, see §7.11
answer { kind: text | numeric, accept?, answer?, tolerance? } Optional question about the model's behaviour

Shape — { kind•, … } where kind is circle (cx, cy, r), rect (x, y, w, h), line (x1, y1, x2, y2) or text (x, y, text). Every geometric field is an expression over state, params and t. A shape may carry repeat: n (integer or expression, ≤ 400), which draws it n times with the variable i bound to 0 … n−1 — this is how you draw particles, molecules or a population without writing a loop.

Determinism. step expressions use only the §7.5 whitelisted functions. random() is not available: a simulation must produce the same numbers on every device, or the answer to a question about it is not the same for two learners. Randomness that an author wants must be written as an explicit formula (e.g. a hash-like expression of i).

Controls. Players MUST provide play/pause, reset, and a visible model clock; the learner MUST be able to move params while paused and see the effect on the next step.

Budget. At most 20 state variables, 20 shapes before repeat, 4000 shape instances after it, and 60 ticks per second. A player MUST cap the wall-clock cost of a tick and pause with a message rather than freezing the page.

Graded when answer is present.

7.4 Grading and completion semantics

Widget state may include attachments: binary files produced by the learner (record audio, sketch PNG). Rules:

7.5 Expression language

Used by slider-explore, plot and future widgets. It is a deliberately small, side-effect-free language:

There are no strings, assignments, loops, or user-defined functions. Implementations MUST NOT evaluate expressions with a host-language eval. Division by zero yields NaN; players render gaps for non-finite values.

7.6 Code-exercise semantics

7.6.1 User interface

Players MUST provide at minimum:

On narrow screens players MAY stack editor and console vertically or use tabs; the editor SHOULD remain usable on a phone keyboard (e.g. an accessory bar with Tab, brackets, quotes).

7.6.2 Run

  1. Take the current editor contents (all files, if files is used).
  2. Execute the entry point in a fresh sandbox (§8.4) with stdin attached.
  3. Stream stdout/stderr to the console as they are produced.
  4. On completion, show the exit status and elapsed time. On timeout or memory limit, show a clear message naming the limit.

Run never affects grading. Learners may Run any number of times.

7.6.3 Submit

For grading: "tests":

  1. For each test, in order, start a fresh sandbox. Run the learner's entry point with the test's stdin attached, capturing its stdout. Then execute the test code in the same interpreter scope, so tests can call the learner's functions and inspect what the program printed via the pre-defined variable __stdout__ (a string).
  2. Record pass/fail, captured output and, on failure, the error message.
  3. Present a results list: test name and ✔/✘ for every test. For non-hidden failed tests, show the error message and the test code; for hidden ones, show only "Hidden test failed".
  4. If all tests pass, mark the widget complete and record the submission. Otherwise increment the failed-attempt counter (used by solutionAfterAttempts).

For grading: "output":

  1. For each case, run the learner's code in a fresh sandbox with the case's stdin.
  2. Compare stdout with the case's expectedOutput using outputMatch:
    • exact — byte-for-byte equality.
    • trimmed — both sides have leading and trailing whitespace (including the final newline) removed, and \r\n normalised to \n; then exact equality.
    • lines — as trimmed, then each line has leading/trailing whitespace removed and internal runs of whitespace collapsed to one space; then line-by-line equality.
  3. On mismatch for a non-hidden case, show a diff of expected vs. actual. For a hidden case show only "Hidden case failed".

Submitting while a Run is in progress MUST cancel it. Learner code state MUST be persisted locally after each Run/Submit so work is not lost across sessions, keyed on (courseId, widgetId).

7.6.4 Test authoring conventions

7.6.5 Language runtimes (informative)

Language Reference runtime Notes
python CPython 3.x compiled to WebAssembly (e.g. Pyodide) Standard library available; third-party packages only if the player bundles them. Players MUST document which packages are available per player version
javascript QuickJS (or equivalent) in WebAssembly ES2020; no DOM, no Node APIs

Runtimes are shipped with the player and loaded lazily on first use. They MUST be available offline after the first load. Future versions of this spec may add languages (e.g. go, rust, c) once suitable WASM toolchains are selected.

7.6.6 Example

:::widget type="code-exercise" id="ex-fizzbuzz"
language: python
prompt: |
  Write a function `fizzbuzz(n)` that returns:

  - `"Fizz"` for multiples of 3,
  - `"Buzz"` for multiples of 5,
  - `"FizzBuzz"` for multiples of both,
  - the number as a string otherwise.

  The starter code prints `fizzbuzz(i)` for 1 to 15 so you can check with **Run**.
starterCode: |
  def fizzbuzz(n):
      # your code here
      pass

  for i in range(1, 16):
      print(fizzbuzz(i))
tests:
  - name: Multiples of 3
    code: |
      assert_equal(fizzbuzz(3), "Fizz")
      assert_equal(fizzbuzz(9), "Fizz")
  - name: Multiples of 5
    code: assert_equal(fizzbuzz(5), "Buzz")
  - name: Multiples of both
    code: assert_equal(fizzbuzz(15), "FizzBuzz")
  - name: Other numbers
    code: assert_equal(fizzbuzz(7), "7")
  - name: Program prints 15 lines
    code: assert_equal(len(__stdout__.strip().splitlines()), 15)
  - name: Large inputs
    hidden: true
    code: |
      assert_equal(fizzbuzz(3000), "FizzBuzz")
      assert_equal(fizzbuzz(3001), "3001")
hints:
  - Check for divisibility by 15 first.
  - "Use the `%` operator: `n % 3 == 0`."
solutionAfterAttempts: 3
:::

7.7 Media object

audio:
  src: assets/audio/cafe-01.mp3   # required; must be an audio asset in the bundle
  transcript: |                   # optional, inline Markdown. See transcriptAfter
    — Hola, ¿qué te pongo?
    — Un café con leche, por favor.
  transcriptAfter: complete       # always | complete | never. Default complete
  playLimit: 2                    # optional, ≥ 1. Omit for unlimited
  speed: [0.75, 1]                # optional, playback rates offered. Default [1]

The shorthand audio: assets/audio/cafe-01.mp3 equals { src: … }.

Rules:


7.8 Notation (ABC)

Notation is written in ABC, not MusicXML: it is compact, diff-friendly, hand-authorable, and sits comfortably inside YAML. A single tune, one voice or two.

abc: |
  X:1
  T:Ode to Joy
  M:4/4
  L:1/4
  K:D
  |: FF GA | AG FE | DD EF | F3E/2E/2 :|

Rules:

7.9 Instrument

instrument:
  kind: piano            # piano is the only built-in in 0.4
  samples:               # OPTIONAL: a course's own recordings, keyed by scientific pitch
    C4: assets/audio/violin-c4.mp3
    C5: assets/audio/violin-c5.mp3
  range: [C2, C6]        # OPTIONAL, informative

Players pitch-shift from the nearest sample. A player MUST NOT fetch instrument sounds from the network — samples are either built in or in the bundle (§8.2 already forbids network access; this makes it explicit for audio).

7.10 Structures (SMILES)

Chemical structures are written in SMILES, for the same reasons ABC was chosen for music (§7.8): compact, text-native, diffable, and hand-authorable.

smiles: "CC(=O)Oc1ccccc1C(=O)O"   # aspirin

Rules:

7.11 Text alternatives for generated visuals

Images carry alt, audio carries a transcript, notation and structures are described from their own data. plot, geometry and simulation draw from expressions, so a player can describe what is on screen but not what it means — the shape of a curve, what a scene is showing, what a model demonstrates.

Authors: write the sentence you would say to someone sitting next to you who glanced away. "Velocity rises in a straight line from 2 m/s to 12 m/s over five seconds" is worth more than any restatement of the axes.


8. Security Requirements for Players and Validators

8.1 No code execution from content

Players MUST NOT execute any author-supplied content as code, with the sole exception of code-exercise code inside the sandbox described in §8.4.

8.2 Network

While rendering a course, players MUST NOT make network requests on behalf of course content. https:// links open in the system browser only after an explicit user tap.

8.3 SVG sanitisation

SVGs MUST be sanitised before signing: remove <script>, <foreignObject>, event handler attributes (on*), external references (href to non-fragment URLs, @import), and <style> blocks containing url(. Validators MUST reject non-sanitised SVGs; signers MAY sanitise in place.

8.4 Code-exercise sandbox

8.5 Determinism

The expression language (§7.5) has no source of randomness and no access to the clock, the device or the learner. Two consequences the format depends on: a simulation produces the same numbers for every learner, so a question about its behaviour has one answer; and no widget can fingerprint the device.

8.6 Resource limits

Players SHOULD cap: lesson size (≤ 1 MiB of Markdown), widgets per lesson (≤ 100), KaTeX expression length (≤ 5 000 chars), and plot samples (≤ 10 000).


9. Internationalisation (optional)

i18n/<lang>/ MAY mirror the lessons/ tree with translated files and a translated manifest.<lang>.json containing only title, subtitle, description and chapter titles. Players pick the best match for the learner's locale and fall back to the manifest language. This section is a placeholder and may change significantly before 1.0.

Accessibility requirements introduced with learner media:


10. Versioning and Compatibility

10.1 Spec versioning

10.2 Course versioning


11. Validator Conformance

A conforming validator MUST check at least:

  1. Archive constraints (§2.1) and layout (§2.2)
  2. Manifest schema and rules (§3)
  3. Content hash completeness and correctness
  4. Asset formats and limits (§2.3), SVG sanitisation (§8.3)
  5. Markdown: forbidden HTML/URLs (§5.3), missing alt text, broken internal links and asset references
  6. Directive names and attributes (§6)
  7. Widget bodies parse as safe YAML and validate against the per-type schema (§7.3); unique widget IDs; expression syntax (§7.5) including in geometry coordinates; bind names reference existing params
  8. Resource limits (§8.6) and determinism (§8.5): no expression may reference an unknown identifier
  9. Media and instrument samples referenced by widgets exist in the bundle; manifest.uses declares every capability the content needs (§3.2) 9a. Asset credit (§3.3): every image, audio and video asset is either covered by assetsByAuthor: true or has a credits entry, or carries a figure credit. A credits entry pointing at an asset that is not in the bundle is an error
  10. Listening groups (§6.2): at least one widget, no nested groups, no widget-level audio inside one
  11. Notation (§7.8) parses; structures (§7.10) parse; answer indices are in range for the notation or structure they address

It SHOULD additionally warn on: unreferenced lessons/assets, very long lessons, lessons without any widget, missing estimatedMinutes, audio without a transcript, a listening group without a transcript, and bestOn omitted by a course that uses drawing.

A conforming validator SHOULD report YAML failures in terms an author can act on — the single most common authoring error is an unquoted value containing a colon. It SHOULD also reject a $…$ span containing a LaTeX command inside a double-quoted YAML scalar: YAML treats the backslash as an escape, and several common commands (\theta, \times, \frac, \beta, \alpha, \nu, \vec) are valid escapes, so the maths is corrupted without any parse error.


12. Minimal Example

hello-course/
├── manifest.json
├── lessons/
│   └── 01-hello.md
└── assets/images/cover.webp

lessons/01-hello.md:

---
title: Hello, Vectors
estimatedMinutes: 5
---

# Hello, Vectors

A **vector** is an arrow with a length and a direction. We write it as
$\vec v = (v_x, v_y)$.

:::tip title="Intuition"
Think of it as "how far to walk, and which way".
:::

:::widget type="slider-explore" id="explore-length"
params:
  - { name: vx, min: -3, max: 3, step: 0.1, default: 1, label: $v_x$ }
  - { name: vy, min: -3, max: 3, step: 0.1, default: 2, label: $v_y$ }
geometry:
  view: { x: [-3, 3], y: [-3, 3] }
  shapes:
    - { kind: vector, to: [vx, vy], label: $\vec v$ }
outputs:
  - { label: Length, expr: sqrt(vx^2 + vy^2) }
caption: Move the sliders and watch the arrow and its length change.
:::

:::widget type="numeric-input" id="q-length"
prompt: What is the length of $(3, 4)$?
answer: 5
tolerance: 0.01
hint: Pythagoras.
:::

:::checkpoint
Nice — you've got the basics.
:::

13. Open Items (post-1.0)

Nothing in this list blocks 1.0. Each would be an additive minor version.


Changelog