Function: renderSvg()
function renderSvg(dotSource: string, engine: EngineName): string;Defined in: index.ts:84
Render a DOT-language string to SVG using the specified layout engine.
Always throws a value implementing GvError: parse failures throw ParseError; layout/render failures surface as RenderError (RENDER_ERROR).
Parameters
dotSource
string
DOT-language graph source
engine
layout engine name (EngineName): a built-in ('dot', 'neato', 'fdp', 'sfdp', 'circo', 'twopi', 'osage', 'patchwork') or any custom-registered name
Returns
string
SVG string
Remarks
Security: when dotSource is untrusted, treat the returned SVG as attacker-controlled markup. Attribute values are XML-escaped (no element or attribute breakout), but URL schemes and resource origins in href/URL/ image/stylesheet are passed through unfiltered, matching native Graphviz. Embedding pages should apply a Content-Security-Policy (or sanitize the markup) — see the "Security" section of the README.
Throws
ParseError if dotSource is not valid DOT
Throws
RenderError if layout or rendering fails