compile()
Compile a JSON string representing an element tree to SVG.JSON string representing the element tree to compile
Compilation options including width, height, fonts, etc.
Returns a
CompileResult containing the SVG string and metadata on success, or a CompileError on failureExample
Errors
ReturnsCompileError with kind:
"parse_error"- Invalid JSON or element structure"layout_error"- Layout computation failed"font_error"- Invalid base64 font data
compile_element()
Compile a parsedElement tree to SVG.
Parsed element tree (Box, Flex, Text, or Image)
Compilation options
Returns a
CompileResult on success, or a CompileError on failureExample
Use
compile_element() when you’ve already parsed the JSON into an Element struct, or when building elements programmatically. Use compile() for direct JSON-to-SVG conversion.compile_document()
Compile a self-contained HTVG document (metadata + content) to SVG.JSON string containing both
meta (compile options) and content (element tree)Returns a
CompileResult on success, or a CompileError on failure