Topic: JSON Canvas Spec 1.0 Formatting Standards for Quartz
π‘ Best Practices (Patterns)
- Grid Alignment: Snap all
xandycoordinates strictly to multiples of 20px. Round group coordinates to 100px for visual harmony. - Z-Order Array Indexing: Order the
nodesarray logically: Groups (Layer 0) β Text (Layer 1) β Files/Links (Layer 2). The first node in the JSON array renders at the absolute bottom. - Implicit Spatial Containment: Define group membership strictly by geometry, not explicitly by parent-child fields. A node belongs to a group ONLY if its
(x, y, width, height)is 100% within the groupβs boundary. - Semantic Palette: Restrict colors to semantic presets
1β6(e.g.,1Red for critical,4Green for stable). Use hex codes only as deliberate escape hatches. - Explicit Edge Routing: Always explicitly declare
fromSideandtoSide(top,right,bottom,left) to prevent layout chaos. Ensure directional edges usetoEnd: "arrow". - MANDATORY Visual Feedback Loop: You must deploy to Quartz and screenshot the result at least once per canvas. Overlaps, clipping, and truncated labels are invisible in JSON and require rendered validation.
- ID Prefix Conventions: Use strict kebab-case prefixes for component identification. Standardize on
grp-{name},txt-{name},f-{name},lnk-{name}, ande-{from}-{to}. - Safe Group Padding: Calculate the first childβs Y-coordinate using
group_y + group_pad (40px) + label_area (60px). Failing to account for the label area causes immediate text collision.
π§ Layout Patterns
- Hub-and-Spoke (Mind Map): Central node radiating outward to categorized groups. Ideal for module maps and dependency graphs.
- Kanban Columns: Vertical, side-by-side lanes. Best suited for pipeline status tracking.
- Flowchart: Top-to-bottom or left-to-right pipelines. Designed for sequential data or decision trees.
- Convergence Funnel: Multiple independent source nodes targeting a single output. Optimal for migrations and aggregation.
π¨ Anti-Patterns & Gotchas
- β Aesthetic Coloring: Do not assign colors randomly. Bypassing semantic presets breaks visual consistency.
- β Implicit Edge Routing: Never omit edge sides. Forcing the renderer to guess causes crossed wires.
- β Inverted Z-Order: Do not place groups at the end of the
nodesarray. This completely occludes child nodes. - β Absolute File Paths: Do not use full system paths. Paths must be strictly relative to the Quartz
content/directory. - β Label Truncation: Do not size file nodes under 400px wide. Narrow nodes truncate link titles.
- β Nested Groups: Do not attempt group-inside-group definitions. JSON Canvas Spec 1.0 lacks nested support.
- β JSON Comments: Do not leave
//or/*in the payload. Quartz will fail to parse the canvas.
π Quick Start & Integration
- Enable via
quartz.config.yamlusing thegithub:quartz-community/canvas-pageplugin. - Embed inside markdown using standard transclusion:
![[canvas-name.canvas]]. - Keep
.canvasfiles under 50KB to avoid excessive Quartz build-time parsing overhead.