@choo-choo/core
v0.2.1
Published
IR, manual builder and SVG renderer for choo-choo railroad diagrams.
Maintainers
Readme
@choo-choo/core
IR, manual builder and SVG renderer for Choo Choo railroad diagrams.
Zero runtime dependencies. SSR-safe: the renderer emits an SVG string and never touches the DOM.
Install
npm install @choo-choo/coreExample
import { diagram, sequence, terminal, render } from "@choo-choo/core";
const ir = diagram(sequence(terminal("return")));
const svg = render(ir);render returns an SVG string — inject it from your framework of choice, or use one of the prebuilt bindings: @choo-choo/react, @choo-choo/vue, @choo-choo/astro, @choo-choo/vanilla.
To build diagrams from a grammar source instead of by hand, combine core with a grammar parser: @choo-choo/parser-ebnf, @choo-choo/parser-antlr, @choo-choo/parser-peg.
Learn more
License
MIT
