Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,18 @@ Measured with `pnpm benchmark:rendering` on the repository marketing email fixtu

**Cached** means the template is compiled once and only the render step is measured. This is the expected production usage — compile at module load, render per request. The "one-time" compile+render cost is comparable to calling `render()` directly.

Plain-text benchmarks measured with `pnpm benchmark:html-to-text` on the repository HTML-to-text fixtures. Lower mean time is better.

| Operation | Fixture | Mean | Throughput | Comparison |
| --- | --- | ---: | ---: | --- |
| `@solid-email/render` `toPlainText` | HTML fixtures | 2.4369ms | 410.36 hz | 3.40x faster than React Email `toPlainText` |
| `@solid-email/render` compiled text template | Solid JSX | 1.4434ms | 692.83 hz | 8.61x faster than React Email plain-text render |
| `@solid-email/render` uncompiled `renderSync` plain text | Solid JSX | 2.8895ms | 346.09 hz | 4.30x faster than React Email plain-text render |
| `@solid-email/html-to-text` `convert` | HTML fixtures | 3.9657ms | 252.16 hz | Direct package converter |
| `html-to-text` `convert` | HTML fixtures | 3.8166ms | 262.01 hz | Direct converter baseline |
| React Email `toPlainText` | HTML fixtures | 8.2867ms | 120.67 hz | React text conversion baseline |
| React Email `render` plain text | React JSX | 12.4310ms | 80.44 hz | React plain-text render baseline |

Bundle size compares built ESM entry files after `pnpm build`; gzip uses Node's `zlib.gzipSync`.

| Package entry | Raw size | Gzip size | Comparison |
Expand Down Expand Up @@ -129,6 +141,55 @@ const html2 = await compiled.render({ name: 'Bob', url: 'https://other.com' });

Use `compileSync()` for the synchronous equivalent (rejects `pretty` output).

### Compile plain-text output

For repeated plain-text bodies, compile the template with `withPlainText: true`. The compiled template keeps a reusable text representation, so each render only substitutes slot values.

```tsx
import { Body, Button, Container, Html, Text } from '@akin01/solid-email';
import { compile, Slot, slot } from '@solid-email/render';

const compiled = await compile(
<Html>
<Body>
<Container>
<Text>
Hello <Slot name="name" />!
</Text>
<Button href={slot('url')}>Open dashboard</Button>
</Container>
</Body>
</Html>,
{ withPlainText: true },
);

const text = await compiled.render(
{ name: 'Alice', url: 'https://example.com/dashboard' },
{ plainText: true },
);
```

For one-off Solid JSX to plain-text output, render the template with `plainText: true`.

```tsx
import { Body, Button, Container, Html, Text } from '@akin01/solid-email';
import { render } from '@solid-email/render';

const text = await render(
() => (
<Html>
<Body>
<Container>
<Text>Hello Alice</Text>
<Button href="https://example.com/dashboard">Open dashboard</Button>
</Container>
</Body>
</Html>
),
{ plainText: true },
);
```

### Slots

Slots mark the dynamic parts of a compiled template.
Expand Down
21 changes: 21 additions & 0 deletions packages/html-to-text/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 Ainul Yaqin

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
38 changes: 38 additions & 0 deletions packages/html-to-text/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# @solid-email/html-to-text

HTML-to-plain-text converter used by Solid Email rendering.

## Install

```sh
pnpm add @solid-email/html-to-text
```

Most Solid Email users should call `render(..., { plainText: true })` from `@solid-email/render`. Use this package directly when converting raw HTML strings or batch-processing HTML outside the renderer.

## Convert HTML

```ts
import { convert } from '@solid-email/html-to-text';

const text = convert('<p>Hello <strong>Alice</strong></p>', {
wordwrap: false,
});
```

## Compile converter options

Compile options once when converting many HTML strings with the same settings.

```ts
import { compile } from '@solid-email/html-to-text';

const toText = compile({
wordwrap: false,
selectors: [{ selector: 'img', format: 'skip' }],
});

const text = toText('<p>Hello <strong>Alice</strong></p>');
```

See the repository README for Solid JSX plain-text rendering examples and benchmarks: https://github.com/Akin01/solid-email
2 changes: 2 additions & 0 deletions packages/html-to-text/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
"./package.json": "./package.json"
},
"files": [
"LICENSE",
"README.md",
"dist/**",
"src/**"
],
Expand Down
21 changes: 21 additions & 0 deletions packages/render/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 Ainul Yaqin

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
82 changes: 82 additions & 0 deletions packages/render/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# @solid-email/render

Render SolidJS email templates to HTML or plain text, and compile templates for repeated renders with slots.

## Install

```sh
pnpm add @solid-email/render solid-js
```

Install `@akin01/solid-email` when using the Solid Email component set.

```sh
pnpm add @akin01/solid-email
```

## Render HTML

```tsx
import { Body, Button, Container, Html, Text } from '@akin01/solid-email';
import { render } from '@solid-email/render';

const html = await render(() => (
<Html>
<Body>
<Container>
<Text>Welcome to Solid Email.</Text>
<Button href="https://example.com">Get started</Button>
</Container>
</Body>
</Html>
));
```

## Render plain text

```tsx
const text = await render(
() => (
<Html>
<Body>
<Container>
<Text>Hello Alice</Text>
<Button href="https://example.com/dashboard">Open dashboard</Button>
</Container>
</Body>
</Html>
),
{ plainText: true },
);
```

## Compile repeated renders

```tsx
import { Body, Button, Container, Html, Text } from '@akin01/solid-email';
import { compile, Slot, slot } from '@solid-email/render';

const compiled = await compile(
<Html>
<Body>
<Container>
<Text>
Hello <Slot name="name" />!
</Text>
<Button href={slot('url')}>Open dashboard</Button>
</Container>
</Body>
</Html>,
{ withPlainText: true },
);

const html = await compiled.render({ name: 'Alice', url: 'https://example.com/dashboard' });
const text = await compiled.render(
{ name: 'Alice', url: 'https://example.com/dashboard' },
{ plainText: true },
);
```

Use `renderSync()` and `compileSync()` only for static templates that do not need async Solid rendering or `pretty` output.

See the repository README for benchmarks and advanced usage: https://github.com/Akin01/solid-email
2 changes: 2 additions & 0 deletions packages/render/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"module": "./dist/node/index.mjs",
"types": "./dist/node/index.d.mts",
"files": [
"LICENSE",
"README.md",
"dist/**"
],
"exports": {
Expand Down
21 changes: 21 additions & 0 deletions packages/solid-email/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 Ainul Yaqin

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
37 changes: 37 additions & 0 deletions packages/solid-email/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# @akin01/solid-email

High-quality SolidJS components for building HTML email templates.

## Install

```sh
pnpm add @akin01/solid-email @solid-email/render solid-js
```

## Example

```tsx
import { Body, Button, Container, Html, Text } from '@akin01/solid-email';
import { render } from '@solid-email/render';

function WelcomeEmail() {
return (
<Html>
<Body>
<Container>
<Text>Welcome to Solid Email.</Text>
<Button href="https://example.com">Get started</Button>
</Container>
</Body>
</Html>
);
}

const html = await render(() => <WelcomeEmail />);
```

## Components

Includes email-safe primitives such as `Html`, `Head`, `Preview`, `Body`, `Container`, `Section`, `Row`, `Column`, `Text`, `Heading`, `Button`, `Link`, `Img`, `Hr`, `Markdown`, `CodeInline`, `CodeBlock`, and `Tailwind`.

See the repository README for benchmarks, compiled template examples, and delivery guidance: https://github.com/Akin01/solid-email
2 changes: 2 additions & 0 deletions packages/solid-email/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
"type": "module",
"types": "./dist/index.d.mts",
"files": [
"LICENSE",
"README.md",
"dist/**"
],
"exports": {
Expand Down
21 changes: 21 additions & 0 deletions packages/tsconfig/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 Ainul Yaqin

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
1 change: 1 addition & 0 deletions packages/tsconfig/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.1.3",
"private": true,
"files": [
"LICENSE",
"base.json",
"node-vitest.json",
"solid-library.json",
Expand Down
Loading
Loading