@atlaskit/email-renderer
TypeScript icon, indicating that this package has built-in type declarations

9.2.3 • Public • Published

Email renderer

This package provides renderer that is capable of rendering email-friendly HTML from ADF documents.

Usage

Use as follows:

import { defaultSchema } from '@atlaskit/adf-schema';
import { EmailSerializer } from '@atlaskit/email-renderer';

const document = ... // Your ADF JSON document

const serializer = EmailSerializer.fromSchema(defaultSchema);
const node = defaultSchema.nodeFromJSON(document);
const result = serializer.serializeFragment(node.content);

Development

Project consists of different serializers in order to render ADF into html

ADF nodes serializers are stored in src/nodes ADF marks serializers are stored in src/marks

HTML rendering occurs via traversal of the ADF and calling the serializer corresponding to each visited ADF Node, as well as applying any marks that exist on a node.

Adding new embedded images / icons

This will generate static image modules that can be used to easily embed inside of email as part of a ADF node serializer, etc.

Currently uses a custom build process, which like this: SVG -> PNG -> Base64 -> TypeScript Module

  • Add the source image to src/static/svg folder and to generator config src/static/image-sources.ts
  • run yarn run build:images

Readme

Keywords

none

Package Sidebar

Install

npm i @atlaskit/email-renderer

Weekly Downloads

597

Version

9.2.3

License

Apache-2.0

Unpacked Size

473 kB

Total Files

440

Last publish

Collaborators

  • atlassianartifactteam