npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-email-studio-convert

v4.0.0

Published

Convert HTML ↔ React Email Studio email_document JSON (no React editor required).

Readme

react-email-studio-convert

Latest: 4.0.0 — Aligned with [email protected]. See CHANGELOG.md.

4.0.0 — Version alignment with studio 7.0.0 (controlled options, palette, presets, custom widgets; no convert API changes).

3.1.4 — Aligned with [email protected].

3.1.0 — Universal export sanitization and Outlook VML backgrounds with [email protected].

Convert between HTML and the React Email Studio email_document JSON format — without the React editor UI.

Use this package in Node scripts, APIs, or CI when you need to:

  • Import pasted or exported HTML into the studio (loadJson)
  • Export saved designs to send-ready HTML (including optional dark-mode CSS)

Install

npm install react-email-studio-convert

No React required. Node.js 18+ is supported (uses happy-dom for DOMParser / HTML normalization when globals are missing).

Monorepo workspace:

"react-email-studio-convert": "workspace:*"

Node.js

ESM

import {
  htmlToStudioDocument,
  studioDocumentToHtml,
} from "react-email-studio-convert";

const doc = htmlToStudioDocument("<p>Hello</p>");
const html = studioDocumentToHtml(doc);

CommonJS

const {
  htmlToStudioDocument,
  studioDocumentToHtml,
} = require("react-email-studio-convert");

const doc = htmlToStudioDocument("<!DOCTYPE html><html><body><p>Hi</p></body></html>");
console.log(studioDocumentToHtml(doc).includes("Hi")); // true

API

| Function | Description | |----------|-------------| | htmlToStudioDocument(html) | HTML → email_document object (or null if empty) | | htmlToStudioJson(html, pretty?) | HTML → JSON string | | studioDocumentToHtml(document, opts?) | Document or JSON string → full HTML email | | normalizeStudioDocument(input) | Canonical email_document object | | parseStudioDocument(input) | Coerce legacy / partial JSON for the editor | | studioDocumentToRows(input) | Document → editor row model | | studioRowsToDocument(rows, settings) | Editor rows → email_document |

Low-level exports (jsonToHtml, htmlToJson, blocksFromImportHtml, makeContentBlock, resolveBlockProps, socialBarTableHtml, …) match react-email-studio / react-email-studio/convert for advanced use.

Supported blocks (export / structured import)

heading, text, html, image, file, button, link, divider, spacer, social (inline table icons), menu, table, layout.

Legacy timer, video, countdown, and videoLink blocks are skipped on import (DEPRECATED_BLOCK_TYPES).

Dark mode

When settings.emailDarkModeEnabled is true (default in new designs), studioDocumentToHtml includes color-scheme meta tags and dark-theme CSS. Override colors via settings.emailDarkPageBg, emailDarkContentBg, etc. (see main package docs).

Example

import {
  htmlToStudioDocument,
  studioDocumentToHtml,
  makeContentBlock,
  resolveBlockProps,
} from "react-email-studio-convert";

const doc = htmlToStudioDocument("<h1>Hi</h1><p>Body</p>");
// Pass to ReactEmailEditor loadJson(doc) or save JSON

const html = studioDocumentToHtml(doc);
// Full <!DOCTYPE html>… document for your ESP

// Build a document block in Node (same presets as editor blockPresets)
const socialBlock = makeContentBlock("social", {
  social: {
    networks: ["linkedin"],
    socialUrls: { linkedin: "https://linkedin.com/company/acme" },
  },
});

Format

The studio document is type: "email_document" with settings and rows[] (each row has columns[].blocks[]). See react-email-studio docs for the full schema.

Related