• Stars
    star
    273
  • Rank 150,780 (Top 3 %)
  • Language
    TypeScript
  • Created about 2 years ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An HTML adapter for Vercel's Satori

Satori HTML

Generate a satori-friendly VDOM from a string of HTML.

What is this?

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!

Example

API

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>');

More Repositories

1

clack

Effortlessly build beautiful command-line apps
TypeScript
5,170
star
2

astro-icon

Inline and sprite-based SVGs in Astro made easy!
MDX
1,072
star
3

microsite

Do more with less JavaScript. Microsite is a smarter, performance-obsessed static site generator powered by Preact and Snowpack.
TypeScript
877
star
4

ultrahtml

TypeScript
521
star
5

natemoo-re

TypeScript
433
star
6

micromorph

A very tiny library for diffing DOM nodes
TypeScript
339
star
7

ultrafetch

RFC-7234 compliant caching for any `fetch` implementation
TypeScript
222
star
8

astro-remote

Render remote HTML or Markdown content in Astro with full control over the output
Astro
173
star
9

ultramatter

<1kB frontmatter parser that supports a reasonable subset of YAML
TypeScript
123
star
10

animate-presence

Effortless element entrance/exit animations
TypeScript
99
star
11

proload

Searches for and loads your tool's JavaScript configuration files with full support for CJS, ESM, TypeScript and more.
JavaScript
81
star
12

astro-capo

TypeScript
57
star
13

eslexer

Incredibly tiny, fast JS tokenizer
TypeScript
57
star
14

astro-php

Please don't use this in production
JavaScript
44
star
15

ultraflag

<1kB CLI flag parser
TypeScript
44
star
16

feed

Astro
43
star
17

magic-element

Automatic custom-elements with zero boilerplate
TypeScript
34
star
18

tslint-stencil

Contributes some helpful tslint rules for Stencil projects
TypeScript
22
star
19

tinyshell

A tiny `node:child_process` wrapper for shell scripts
TypeScript
21
star
20

konami-listener

Vanilla web component that listens for the Konami Code
JavaScript
20
star
21

ultramark

TypeScript
19
star
22

tsdx-monorepo

TypeScript
19
star
23

goldmark

JavaScript
19
star
24

project-template

TypeScript
19
star
25

tiny-decode

Decode HTML entities the browser-friendly way
JavaScript
18
star
26

prettier-plugin-style-order

Prettier plugin to automatically sort style declarations
JavaScript
16
star
27

stencil-forms

πŸ“πŸ€― Stencil component to automatically manage form state
TypeScript
14
star
28

miles-of-code

Astro
13
star
29

microsite-demo

TypeScript
11
star
30

stencil-tools

Editor enhancements and utilities for Stencil projects
TypeScript
10
star
31

emojex

Emoji-based Regular Expressions
TypeScript
10
star
32

astro-client-hints

TypeScript
9
star
33

astro-run

TypeScript
9
star
34

clack.cc

Astro
9
star
35

astro-form

Astro
7
star
36

raycast-microblog

TypeScript
7
star
37

topic

TypeScript
7
star
38

exo-store

TypeScript
6
star
39

astro-breadcrumbs

Astro
6
star
40

astro-beep

JavaScript
6
star
41

gamepad

Provides a simple, event-based API for Gamepads on the web
TypeScript
5
star
42

esm-create

npm init, but better
JavaScript
5
star
43

experiment--astro-editor

Astro
5
star
44

orbit

Astro
4
star
45

blocks

TypeScript
3
star
46

require-or-import

JavaScript
3
star
47

stencil-markdown

Stencil plugin that allows Markdown files to be imported as FunctionalComponents
TypeScript
3
star
48

a11y-types

Typescript Definitions for ARIA attribute constants
TypeScript
2
star
49

microstream

TypeScript
2
star
50

bottom-sheet

Bottom sheet web component
TypeScript
2
star
51

stencil-hooks

TypeScript
2
star
52

typescript-plugin-stencil

Typescript plugin for a smoother Developer Experience within Stencil projects
TypeScript
2
star
53

midu-astro

Astro
2
star
54

hibiscus

A *VERY ROUGH* proof of concept using Stencil to dynamically load and animate an SVG-based font.
TypeScript
1
star
55

astro-bundle-demo

JavaScript
1
star
56

node-shqxzf

Created with StackBlitz ⚑️
1
star
57

use-linked-context

JavaScript
1
star
58

pronouns

HTML
1
star
59

astro-playground

TypeScript
1
star
60

astro-dev-plugin-sample

Astro
1
star
61

actions-playground

Shell
1
star
62

test-social-web

1
star
63

astro-template-blog

1
star
64

astro-gh-pages-test

Astro
1
star
65

astro-minimal

JavaScript
1
star
66

microsite-templates

TypeScript
1
star
67

text-wrap-balance

1
star
68

node-wfhqwq

JavaScript
1
star
69

git-comments-test

1
star
70

astro-demo-named-slots

Astro
1
star
71

vscode-filename-snippets

TEST
TypeScript
1
star
72

astro-vercel-rewrites

Astro
1
star
73

action-test

TypeScript
1
star
74

bug--astro-netlify-libsql

TypeScript
1
star
75

natemoo-re.github.io

Public site
HTML
1
star