Understand the Parse → Layout → Render pipeline
mainThe project follows a consistent three-stage pipeline for all diagram types:
- Parser (
parser.ts): A pure function that takesstring[](preprocessed lines) and returns a typed AST (e.g.,ErDiagram,XYChart). - Layout (
layout.ts): An async function that takes the parsed AST andRenderOptionsto return a positioned structure with pixel coordinates. It usesestimateTextWidth()for sizing. - Renderer (
renderer.ts): A function that takes the positioned structure,DiagramColors, font, and transparency settings to return an SVG string. It uses CSS custom properties for all coloring.