simplediag
v0.2.4
Published
TypeScript renderer for nwdiag-compatible network diagrams. Browser-native, no Python/Java backend.
Maintainers
Readme
simplediag
simplediag is a small TypeScript package for rendering nwdiag-compatible network diagrams to SVG. Browser-native, no Python or Java backend required.
Install
pnpm add simplediag
# or: npm install simplediag / yarn add simplediagUsage
import { renderFromSource } from "simplediag";
const result = renderFromSource(`
nwdiag {
network dmz {
address = "10.0.0.0/24";
web01 [address = "10.0.0.10"];
}
}
`);
if (result.svg) {
console.log(result.svg);
}It targets the common-case nwdiag input — multiple networks, multi-homed nodes, groups, peer links, addresses, shapes, defaults. The rendering is implemented in TypeScript under MIT.
For features that go beyond standard nwdiag (programmatic API, structured diagnostics, additional shapes, peer-link attributes, Manhattan routing, the networking shape pack), see SUPERSET.md. That document also holds the placeholder list of planned superset additions.
nwdiag corpus parity
simplediag is verified against the official nwdiag test corpus
(src/nwdiag/tests/diagrams/ + examples/nwdiag/ from
blockdiag/nwdiag):
pnpm --filter simplediag audit:nwdiagThe script fetches the upstream fixtures (cached under .audit-cache/)
and runs each through parse → resolve → layout → render. Current parity
on 28 fixtures: 100% (27 PASS + 1 intentional error correctly
rejected).
