diagrams-js/svg-serialization
Installation
SKILL.md
This skill builds on diagrams-js/getting-started and diagrams-js/provider-nodes. Read them first for foundational concepts.
diagrams-js — SVG Serialization
Export diagrams to SVG format with embedded metadata and import them back. SVG serves as both a visual image and a self-contained data format, enabling round-trip editing without separate JSON files.
Setup
import { Diagram } from "diagrams-js";
import { EC2 } from "diagrams-js/aws/compute";
const diagram = Diagram("My Architecture");
diagram.add(EC2("Server"));
// Render to SVG (includes embedded metadata by default)
const svg = await diagram.render();