Welcome! These pages are written for instructors — anyone who wants to add a lesson to the Interactive Primer. This little corner of the tree is a worked set of examples you can read, copy, and adapt.
Every lesson is a single, self-contained .html file under
concepts/. There is no build step: you write a
page, drop it in the folder, and it works. The look-and-feel, the page header,
the progress controls, and the navigation map are all added for you.
Concepts form a tree (technically a DAG): each concept names the concepts it has as prerequisites, and that's the only structure the Primer needs. From those links it works out a learning order, an implied level for every concept, and the little three-column map you can see at the top and bottom of this page.
This page hangs directly off
the root of the tree, and the
One special child hangs off this page:
Inside your content you have a small palette of building blocks. Pick the ones that suit your idea — there is no fixed template, and leaning on the same recipe everywhere makes the Primer feel repetitive.
<primer-card>.<primer-math> typesets LaTeX,
inline like <primer-vignette> tucks a fun
digression behind a click, and <primer-theorem> states a formal law in a
labelled box. Demos below.
<primer-code> is a themed, highlighted
code block; add run and the learner can edit it and execute it in the browser.
<primer-manim> plays a
narrated diagram on a Play button (see the
Pythagorean Theorem).
<primer-chart> plots
a function on axes (with optional sliders), <primer-chart-3d> does the
same in a rotatable 3-D box, and <primer-geometry> draws figures you can
step through. Worked examples are below.
<primer-geometry-problem> is a
figure the learner works: a fresh angle-chase generated every Refresh.
<primer-video> embeds a YouTube clip behind a
click-to-play thumbnail.
<primer-ref> links to another
concept and declares a prerequisite edge in the tree.
<primer-quiz> builds a test from
questions you author inline. That's the next page:
A self-attested confidence rating (the stars below) is added to every page automatically — learners use it to tell the Primer how they're doing.
Two elements let you step out of the main flow. A <primer-vignette> is a
collapsible digression: an intriguing question on the closed card, and the pay-off inside.
Use it for the interesting-but-inessential — the "why", a scrap of history, a surprising
case. Click to open:
The same element is the right home for a "Watch out!" note about a classic mistake — give it
title="Watch out!". For a genuine theorem, law or key result, reach
instead for <primer-theorem>, whose eyebrow reads "Theorem — {name}":
On a programming page, <primer-code> renders a themed, lightly
highlighted block. Add the run attribute and it grows Code /
Output tabs and a Run ▶ button — the snippet is transpiled
from TypeScript and executed in a sandboxed engine in the browser, with
console.log feeding the Output tab. The Code pane is editable, so learners can
tweak it and re-run. Press Run:
Write every example in TypeScript (beginner snippets are just untyped TS,
identical to JavaScript; introduce : number, interface and the rest
as the concepts arrive). Escape <, > and
& in the body.
Maths is visual, so two elements let you draw. <primer-chart>
plots a function on axes — give it sliders and the curve redraws live as the
learner drags them. Here is
<primer-geometry> draws figures — points, lines, angles and
polygons — and can reveal a construction one step at a time, so an idea
unfolds at the learner's pace. Use the controls beneath the figure to step through:
Both are themed automatically (they re-colour with light / dark / fun) and need no
build step — you register each one in a small inline
<script type="module"> at the foot of the page, just like the
block powering the two figures above. For richer examples see
Properties of sin(x)
(charts with sliders) and
Parallel Lines (stepped
diagrams) — or browse the whole tree as one graph.
When an idea lives in space, <primer-chart-3d> renders a
drag-rotatable 3-D box — points, vectors and surfaces projected to SVG, so
it themes like every other figure and needs no WebGL. Drag to spin it, or move the sliders to
change the vector:
Sliders sit below the figure by convention, and share the same
registerChartSliders group machinery as the 2-D charts.
<primer-geometry-problem> gives the learner a figure to work. A
forward-chaining theorem engine synthesises a fresh angle-chase — some angles given, the rest
blank — and it's different on every Refresh. Fill in the boxes, then
Check. (The pool of theorems it may use is gated by a page's prerequisites;
this demo borrows the parallel-lines toolkit.)
<primer-video> embeds a YouTube clip. It shows only a thumbnail and a play
facade until clicked, so nothing loads from YouTube until the learner asks for it: