Function: render()
function render(
g: Graph,
format: OutputFormat,
opts?: RenderOptions): string;Defined in: render/public.ts:113
Render a (parsed or built) graph to the requested format string.
Lifecycle: createDefaultContext → layout → deviceRender → freeLayout. Error handling mirrors renderSvg: GvError-like throws re-surface unchanged; unknown throws become RenderError('RENDER_ERROR').
Parameters
g
graph produced by parse(...) or the builder API
format
target output format
opts?
optional engine override (default: 'dot')
Returns
string
rendered string in the requested format
Remarks
Security: for the markup formats (svg, cmapx, imap), treat the output as attacker-controlled when the source graph came from untrusted DOT. Attribute values are XML-escaped, but URL schemes and resource origins (href/URL/image/stylesheet) are passed through unfiltered, matching native Graphviz. Apply a Content-Security-Policy or sanitize before embedding — see the README "Security" section.
Throws
RenderError on layout or render failure
See
lib/gvc/gvc.c:gvRender