Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
satori-html
Advanced tools
Generate a [satori](https://github.com/vercel/satori)-friendly VDOM from a string of HTML.
Generate a satori-friendly VDOM from a string of HTML.
Satori is an amazing library for generating SVG strings from pure HTML and CSS.
Unfortunately, it is built on top of React's JSX and expects "React-elements-like objects". This library (satori-html
) bridges that gap, generating the necessary VDOM object from a string of HTML.
Note Satori supports a limited subset of HTML and CSS features, due to its special use case. Please use inline styles rather than class-based styling!
satori-html
exports an html
helper, which transforms HTML strings into an object that is compatible with satori
.
import satori from "satori";
import { html } from "satori-html";
const markup = html`<div style="color: black;">hello, world</div>`;
// See https://github.com/vercel/satori#documentation
const svg = await satori(markup, {
width: 600,
height: 400,
fonts: [],
});
The html
utility can be used as a tagged template literal or as a function.
// Tagged Template Literal
const tagged = html`<div style="color: ${color};">hello, world</div>`;
// Function
const fn = html('<div style="color: black;">hello, world</div>');
FAQs
Generate a [satori](https://github.com/vercel/satori)-friendly VDOM from a string of HTML.
We found that satori-html demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.