Function: renderDiagramSvgString()
function renderDiagramSvgString(
model,
geometry,
opts?
): string;
The diagram as a standalone SVG document: literal colours for the chosen mode (works in tools
without CSS variable support), plus an embedded <style> with the --rv-* variables and fonts.
Pure: works in Node and in browsers.
Parameters
model
geometry
opts?
SvgExportOptions = {}
Returns
string
Example
import { writeFileSync } from 'node:fs';
import { compileDbml, layoutDiagram } from '@relvista/core';
import { renderDiagramSvgString } from '@relvista/renderer';
const { model } = compileDbml(source);
const geometry = await layoutDiagram(model!);
writeFileSync('schema.svg', renderDiagramSvgString(model!, geometry, { colorMode: 'dark' }));