The map
Parsers output a Model; layout, geometry and render take only a Model. Adding an input language touches only svugy-parse.
| Layer | Takes | Returns |
|---|---|---|
| Model | builder calls | an admitted Model, cut into layers |
| Parsing | Markdown, d2, JSON | Import: model, errors, warnings |
| Layout | Model | LevelPlans: footprints, routes, stubs in plan space |
| Geometry | Model, LevelPlans | Scene: projected faces, arcs, labels in paint order |
| Render | Scene | SVG text |
| Runtime | the interactive SVG | navigation, in the browser |
StaticSvg::render: lay out, project, write the whole model.InteractiveSvg::render: cut the model into layers, lay out and project each, write all of them into one file.- Output is deterministic: same input, same bytes on Linux, macOS and wasm.
Crates
svugy-model:Model,ModelBuilder, validation, layers. No svugy dependency.svugy-parse:markdown,d2,json.svugy: layout, geometry, render; embeds the runtime.svugy-cli: thesvugybinary.svugy-wasm: Markdown or d2 to interactive SVG in the browser; runs this book’s live editors.svugy-dagre:LeftToRightLayout::node_centres, dagre’s layered layout cut down from dagre-dgl-rs to whatsvugyuses, deterministic.
svugy, drawn by svugy
Source: examples/svugy/svugy.md, also the golden test.