@schemd/core · v0.3.3 · MIT
Schematics are
source code.
We treat a schematic the way a compiler treats source. Write electrical, logic, quantum, and UML diagrams as plain text; the pipeline tokenizes each declaration, validates its options against the component kind you named, routes traces around component bodies, and emits deterministic, accessible SVG — on a server, with zero dependencies.
npm i @schemd/core - nodes
- 6
- wires
- 6
- bytes
- 19,641
- compile
- 11 ms
// Native source + junction + physically rotated shunt capacitor
source:VIN "V_{in}" at (80, 120) #blue [type=voltage-ac]
resistor:R1 "10 kΩ" at (260, 120) #amber
junction:VOUT "output node" at (440, 120) #cyan
capacitor:C1 "100 nF" at (440, 250) #cyan [orientation=down]
ground:GND "0 V" at (220, 350) #slate
port:OUT "V_{out}" at (680, 120) #emerald
VIN.positive -> R1.in #blue [line]
VIN.negative -> GND.in #slate [ortho]
R1.out -> VOUT.node #amber [line]
VOUT.node -> C1.in #cyan [ortho]
C1.out -> GND.in #cyan [ortho]
VOUT.node -> OUT.in #emerald [line marker-end=arrow]the pass, end to end
Text in. Vector out. Four deterministic passes.
- 01
Tokenize
Each declaration is lexed into kind, id, label, coordinate, color, and options.
- 02
Validate
Options are checked by name against the kind you named — unknowns fail loudly.
- 03
Route
Orthogonal traces escape each body, avoid every obstacle, and bridge true crossings.
- 04
Emit
A deterministic, accessible SVG — byte-identical for identical source.
what you get
An engineering compiler, not a drawing toy.
Two-line grammar
Components and connections. Everything else is bracketed options, validated by name against the kind you chose — so a typo is an error at compile time, never a silent wrong drawing.
Zero dependencies
No DOM, no browser layout pass, no Markdown parser. The compiler runs on a server or during a build — this very page compiled its own hero, four ways.
Deterministic output
Identical source yields byte-identical SVG. Diagnostics carry exact one-based line numbers.
Obstacle-aware routing
Orthogonal traces route around bodies with clearance; crossings get draftsman bridge arcs, never false junctions.
Three output budgets
default stays static; embedded-css adds theme styles; full instruments every node, port, and wire.
Bounded by design
Hard ceilings on everything. The writer refuses to exceed them, so a runaway document fails fast instead of exhausting the server.
- 512
- components
- 2,048
- connections
- 32,768
- wire crossings
- 2 MiB
- SVG output