Enlightened library to convert HTML and CSS to SVG
10 days ago
- #SVG
- #JSX
- #HTML-to-SVG
- Satori is a library for converting HTML and CSS to SVG, useful for generating images like Open Graph and social cards.
- It supports JSX syntax for easy use, rendering elements into SVG strings with specified dimensions.
- Satori only accepts pure, stateless JSX elements and supports a limited subset of HTML and CSS features.
- Flexbox layout is supported, similar to React Native, covering most common CSS features but not all.
- Custom fonts must be specified and provided as ArrayBuffer or Buffer, supporting TTF, OTF, and WOFF formats.
- Satori can render text in different locales and supports dynamic loading of emoji images and fonts.
- It can be used in browsers, Node.js, and Web Workers, with a standalone build option for environments with WASM loading limitations.
- Debugging features include drawing bounding boxes and adjusting layout precision for high-DPI displays.