CarbonSheet Schema & Live Render Specification
Detailed guide to the CarbonSheet Zod schema structure alongside live rendered previews of every component element.
1. Overview & Architecture
CarbonSheet follows a Documentation as Code philosophy. Cheat sheets are structured JSON files defined with Zod schemas. They support code highlighting, token callouts, type evaluations, interactive tables, flowcharts, and gotcha callouts.
src/content/sheets/*.json → SheetMetadataSchema.parse() → SubtopicCard Component2. SheetMetadata (Root Schema)
Top-level properties describing the cheat sheet technology, difficulty, tags, and array of sections.
{
"id": "kotlin-core",
"slug": "kotlin",
"title": "Kotlin Syntax & Patterns",
"description": "High-density reference guide for Kotlin language constructs.",
"technology": "Kotlin",
"category": "Backend",
"difficulty": "INTERMEDIATE",
"tags": ["kotlin", "jvm", "android"],
"aliases": ["kt", "android-kotlin"],
"relatedSheets": ["java", "android-jetpack-compose"],
"sections": [ ... ]
}3. Code Blocks, Tabs & Annotations
Supports syntax highlighting, token callouts, type output arrows (input » output), and external playground links.
Annotated Code Blocks & Type Evaluations
Code blocks support language highlighting, token callout annotations, and type evaluations (input » output).
<T>Generic type parameter T scoped to function
asSequence()Creates lazy evaluation pipeline (no intermediate allocations)
Sequence operations are evaluated lazily. Terminal operators like .toList() trigger execution.
4. Structured Comparison Tables
Render structured matrices for feature comparison, operational parameters, or protocol benchmarks.
Structured Comparison Table
Tables organize technical parameters, feature flags, or version differences into clear matrix layouts.
| Collection | Order Preserved | Duplicates | Lookup Time |
|---|---|---|---|
| List / ArrayList | Yes | Allowed | O(1) by index |
| Set / HashSet | No | Unique Only | O(1) hash lookup |
| Map / HashMap | No | Unique Keys | O(1) by key |
| TreeSet / TreeMap | Sorted | Unique | O(log N) tree traversal |
Standard collections are not thread-safe. Use ConcurrentHashMap or Collections.synchronizedList for concurrent writes.
5. Visual Flowchart Diagrams (Mermaid)
Embedded Mermaid flowcharts render system architecture and decision pipelines directly inline.
Architecture & Flowchart Diagrams
Render live Mermaid flowcharts or SVG diagrams to illustrate data flows and system architecture.
6. Callouts & Gotchas
Titled notice boxes with custom icons and color themes (green, amber, blue, red, purple).