- Lang tag:
kind:namewherekinddetermines the block type andnameis the unique identifier - Parameters: Optional key-value pairs after the lang tag
- Content: The visualization data/source
- Regions: Optional named sub-elements below a
---separator (see Regions)
Code Blocks
Syntax-highlighted source code with line-level animation and focus.Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
lang | string | Yes | Syntax highlighting language |
Supported Languages
typescript, javascript, tsx, jsx, python, rust, go, java, c, cpp, sql, bash, json, yaml, html, css, text
Inline Annotations
Add// ! annotation text on a code line. Stripped from display, rendered as floating callout.
Region Targets
Line numbers, ranges, or combinations:Shorthand
A bare language tag like```typescript works as ```code lang=ts.
Data Blocks
Data structure visualizations. 40+ types across 12 layout primitives.Linear Structures
Array
- Values in square brackets, comma-separated
- Pointers:
^pointer-name=index - Regions target indices
Stack
- Vertical column, bottom = index 0
^top=Npointer
Queue
- Horizontal row with front/rear pointers
Deque
- Same as queue with bidirectional arrows at both ends
Ring Buffer
| Parameter | Type | Required | Description |
|---|---|---|---|
capacity | number | Yes | Total slots in the ring |
- Cells on a circle
- Active segment (head→tail) accent-colored
- Use
_for empty slots
Chain Structures
Linked List
- Nodes:
(id value) - Links:
-> - Terminus:
-> null - Blank line separates disconnected groups
Doubly Linked List
- Same as linked-list but edges are bidirectional (
<->)
Skip List
- One line per level (highest first)
- Same node at multiple levels vertically aligned
Tree Structures
Tree
N-ary tree with 15 variants. Replaces legacybinary-tree.
Indentation format (n-ary):
(id)or(id:annotation)— annotation is text after colon- 2-space indent = one level deeper
- First unindented node = root
^name: nodeIdfor pointers
generic (default), bst, avl, red-black, heap-min, heap-max, splay, treap, aa, segment, interval, fenwick, merkle, kd, rope
Note: binary-tree is an alias for tree (backward compat).
B-Tree Family
| Parameter | Type | Required | Description |
|---|---|---|---|
order | number | Yes | Maximum keys per node |
variant | string | No | b-tree, b-plus-tree, 2-3-tree, 2-3-4-tree |
- Wide-rect nodes containing multiple keys:
(id: k1, k2, k3) - Indentation for children
- B+ tree adds horizontal leaf links: use
variant=b-plus-tree
Trie Family
*= terminal node (gets filled marker)- Single-char nodes for trie, multi-char for radix-tree
trie (default), radix-tree, suffix-tree
Hash and Probabilistic Structures
Hash Map
- Vertical bucket column on left
- Horizontal chains extend right
N:= bucket index(id value)= chain nodes
Bit Array / Bloom Filter
| Parameter | Type | Required | Description |
|---|---|---|---|
variant | string | No | bloom-filter, cuckoo-filter, count-min-sketch, hyperloglog |
rows | number | No | Multiple rows (count-min sketch) |
- Row of small square cells
- Active bits = accent fill
- Hash function lines:
name: idx1, idx2, ...
Matrix
- 2D grid with row/column headers
- First line = column labels
- Data rows =
Label [ values ]
Graph
| Parameter | Type | Required | Description |
|---|---|---|---|
layout | string | No | ring (default), force, tree, grid, bipartite |
- Directed:
-> - Undirected:
-- - Weights:
: N
Composite Structures
Union-Find
- Dual view: parent array on top, forest below
LSM Tree
- Vertical stack
- Memtable at top, levels below with sorted runs
Fibonacci Heap
- Multiple trees in a row
- Root chain with doubly-linked dashed edges
- Min pointer from above
Diagram Blocks
Architecture-style node-and-edge diagrams.Node Definition
Syntax:nodeId [type] or nodeId [type key=value]
Node IDs: Letters, digits, underscores, hyphens (e.g., my-api, cache_01)
Node types:
service (default), database, client, user, server, cache, queue, message-queue, load-balancer, api-gateway
Icons
Rendering: Nodes render as icons with a label below (not boxes). Every node gets an AWS icon by default based on its type. Icon override: Addicon=aws:<key> to force a specific AWS icon:
| Key | Aliases | Maps To |
|---|---|---|
apigateway | api-gateway | Amazon API Gateway |
elb | load-balancer | Elastic Load Balancing |
rds | database | Amazon RDS |
elasticache | cache | Amazon ElastiCache |
sqs | queue, message-queue | Amazon SQS |
s3 | object-store | S3 Standard |
cloudfront | cdn | Amazon CloudFront |
cognito | auth | Amazon Cognito |
ec2 | server, service, compute | Amazon EC2 |
client | — | Resource Client |
user | users | Resource User |
Edges
a --> b— directed edgea --label--> b— labeled edge
Groups
{Group Name: node1, node2} — visual cluster
Regions
Target node IDs.Math Blocks
LaTeX expressions via KaTeX.- Expressions separated by blank lines
- Auto-IDs:
expr-0,expr-1, … - Regions target expression IDs
Chart Blocks
Data visualizations with labeled axes. Simple format:| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | No | bar (default), line, scatter, area |
Preview Blocks
HTML or React rendered in an isolated iframe. Raw HTML:| Parameter | Type | Required | Description |
|---|---|---|---|
template | string | No | html (default), react |
@container queries (not @media) for responsive behavior. The iframe width varies with split layout.
TypeScript Definition
Fromsrc/types/lesson.ts: