Skip to content

renderSvg

Renders PlantUML source to an SVG string.

pub fn render_svg(source: &str) -> Result<String, RenderError>
use plantuml_engine::render_svg;
let svg = render_svg("@startuml\nAlice -> Bob: hello\n@enduml")?;
println!("{svg}");

Returns RenderError::ParseFailed when the source cannot be parsed as a supported diagram type (currently sequence diagrams only). Returns RenderError::Utf8 if the rendered output is not valid UTF-8.

import { renderSvg } from '@vgerbot/plantuml';
const svg = await renderSvg('@startuml\nAlice -> Bob: hello\n@enduml');