@mmds/excalidraw
v0.1.0
Published
Convert MMDS JSON to Excalidraw format with polyline edge routing
Downloads
4
Maintainers
Readme
@mmds/excalidraw
Converts MMDS JSON (mmdflux's intermediate format) into Excalidraw .excalidraw files. Nodes become rectangles, diamonds, or ellipses; edges become polyline arrows with labels. Subgraph membership is preserved as Excalidraw groups.
Install
npm install -g @mmds/excalidrawOr use directly with npx (no install needed):
mmdflux --format mmds diagram.mmd | npx @mmds/excalidraw > out.excalidrawUsage
Pipe MMDS JSON from mmdflux into the adapter:
# Layout-level (straight center-to-center arrows)
mmdflux --format mmds diagram.mmd | npx mmds-to-excalidraw > out.excalidraw
# Routed-level (polyline edge paths from mmdflux's router)
mmdflux --format mmds --geometry-level routed diagram.mmd | npx mmds-to-excalidraw > out.excalidrawOptions
| Flag | Short | Values | Default | Description |
|------|-------|--------|---------|-------------|
| --output | -o | json, url | json | Output format — Excalidraw JSON or a shareable excalidraw.com URL |
| --open | | | false | Upload and open the diagram in your browser |
# Get a shareable URL instead of JSON
mmdflux --format mmds --geometry-level routed diagram.mmd | npx mmds-to-excalidraw -o url
# Open directly in browser (also prints JSON to stdout)
mmdflux --format mmds --geometry-level routed diagram.mmd | npx mmds-to-excalidraw --open
# Open in browser, only print the URL
mmdflux --format mmds --geometry-level routed diagram.mmd | npx mmds-to-excalidraw -o url --openOpen the resulting .excalidraw file in excalidraw.com or the Excalidraw VS Code extension.
Geometry levels
- layout (default) — node positions and sizes only; edges are drawn as straight lines between node centers.
- routed — includes full edge paths with waypoints, producing right-angle polyline arrows that match mmdflux's text output.
Scale
Node and edge coordinates are scaled from dagre layout units to pixel space. The default scale factor is 3. Override it with the SCALE environment variable:
mmdflux --format mmds diagram.mmd | SCALE=5 npx mmds-to-excalidraw > out.excalidrawHow it works
- Reads MMDS JSON from stdin
- Maps MMDS node shapes to Excalidraw types (rectangle, diamond, ellipse) with text-aware sizing
- Converts edges to Excalidraw arrows, snapping endpoints to node boundaries
- Computes viewport zoom/scroll to fit the diagram
- Writes a complete
.excalidrawJSON document to stdout (or uploads to excalidraw.com with--output url/--open)
