Basic Syntax
Use a code fence with thedata kind and type parameter:
```data:name type=structure-type
name: Unique identifier for the blocktype: Data structure type (see below)
Data Structure Types
Handhold supports 17 data structure categories with 40+ variants:Linear Structures
Linear Structures
Array (type=array)
Fixed-size contiguous elements with index-based access.- Values in square brackets, comma-separated
- Pointers:
^pointer-name=index - Regions target numeric indices
Stack (type=stack)
LIFO structure with push/pop operations.- Vertical column, bottom = index 0
^top=Nmarks the stack pointer
Queue (type=queue)
FIFO structure with enqueue/dequeue operations.- Horizontal row with front/rear pointers
Deque (type=deque)
Double-ended queue with operations at both ends.- Same as queue with bidirectional arrows
Ring Buffer (type=ring-buffer)
Circular buffer with fixed capacity.- Cells arranged in a circle
- Active segment (head→tail) highlighted
- Parameter:
capacity=N
Chain Structures
Chain Structures
Linked List (type=linked-list)
Singly-linked nodes with next pointers.- Nodes:
(id value) - Links:
-> - Terminus:
-> null - Blank line separates disconnected groups
Doubly Linked List (type=doubly-linked-list)
Bidirectional links between nodes.- Same as linked-list but with
<->edges
Skip List (type=skip-list)
Multi-level linked list for fast search.- One line per level (highest first)
- Same node at multiple levels vertically aligned
Tree Structures
Tree Structures
Tree (type=tree)
N-ary tree with 15 specialized variants.Indentation format (n-ary):generic- Plain tree (default)bst- Binary search treeavl- AVL tree (shows balance factors)red-black- Red-black tree (shows colors)heap-min/heap-max- Min/max heapsplay- Splay treetreap- Treap (tree + heap)aa- AA treesegment- Segment treeinterval- Interval treefenwick- Fenwick tree (binary indexed tree)merkle- Merkle treekd- K-d treerope- Rope data structure
(id)or(id:annotation)- annotation appears after colon- 2-space indent = one level deeper
- First unindented node = root
^name: nodeIdfor pointers
B-Tree Family (type=b-tree)
Multi-way search trees with wide nodes.b-tree- Standard B-tree (default)b-plus-tree- B+ tree with leaf links2-3-tree- 2-3 tree2-3-4-tree- 2-3-4 tree
order=N- Maximum keys per nodevariant=type- Specific B-tree variant
(id: k1, k2, k3)- Node with multiple keys- Indentation for parent-child relationships
Trie Family (type=trie)
Prefix trees for string storage and search.trie- Standard trie (default)radix-tree- Compressed triesuffix-tree- Suffix tree
*suffix marks terminal nodes- Single-char for trie, multi-char for radix-tree
Fibonacci Heap (type=fibonacci-heap)
Collection of min-heap-ordered trees.- Multiple trees in a row
min:specifies minimum elementmarked:comma-separated marked nodes
Hash Structures
Hash Structures
Hash Map (type=hash-map)
Hash table with chaining for collision resolution.- Vertical bucket column on left
- Horizontal chains extend right
N:= bucket index(id value)= chain nodes
Bit Array (type=bit-array)
Compact bit storage for probabilistic structures.bloom-filter- Bloom filter (default)cuckoo-filter- Cuckoo filtercount-min-sketch- Count-min sketchhyperloglog- HyperLogLog
rows=N- Number of rows (for count-min sketch)
- Row of bits:
[0, 1, 0, ...] - Hash highlights:
hashName: idx1, idx2, ...
Graph Structures
Graph Structures
Graph (type=graph)
General graph with multiple layout algorithms.ring- Circular layout (default)force- Force-directed layouttree- Hierarchical tree layoutgrid- Grid-based layoutbipartite- Two-column bipartite layout
- Directed:
-> - Undirected:
-- - Weights:
: N - Comma-separated targets
Matrix & Arrays
Matrix & Arrays
Matrix (type=matrix)
2D grid with row/column headers.- First line = column labels
- Data rows:
Label [ values ]
Composite Structures
Composite Structures
Union-Find (type=union-find)
Disjoint set union with path compression.- Three arrays: elements, parent indices, ranks
- Dual view: array on top, forest below
LSM Tree (type=lsm-tree)
Log-structured merge tree with levels.- Vertical stack: memtable at top, levels below
- Multiple runs per level (separated by spaces)
Regions
Regions target specific elements by ID:Triggers
Data structures support rich animation triggers:{{focus: region}}- Highlight specific nodes (others dim){{pulse: region}}- Brief emphasis animation{{flow: path}}- Animated flow through edges (looping){{trace: path}}- Highlight a path through the structure{{draw: edges}}- One-shot edge drawing animation{{pan: region}}- Center viewport on specific nodes{{annotate: region "text"}}- Floating labels on nodes