Editor.js HTML Parser

4.0.5 · active · verified Tue Apr 21

editorjs-html is a robust, lightweight, and highly customizable utility designed to transform Editor.js's clean JSON output into standard HTML. The current stable version is 4.0.5, which represents a complete rewrite focusing on improved modularity, readability, and modern dependency usage. This library offers flexible integration across various JavaScript environments including plain JavaScript/TypeScript, React, Angular, and Vue. It supports all common Editor.js blocks out-of-the-box and provides a clear mechanism for extending its capabilities to parse custom Editor.js blocks. A key differentiator is its emphasis on strict parsing options and type safety, leveraging Editor.js's own type definitions for development ease. While a specific release cadence isn't explicitly stated, the rapid iteration to v4 suggests active maintenance and responsiveness to the Editor.js ecosystem.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates initializing the parser and converting a full Editor.js data object into an array of HTML strings, then joining them.

import edjsHTML from 'editorjs-html';

// Example Editor.js data
const editorjsData = {
  blocks: [
    {
      id: "qweasd123",
      type: "header",
      data: {
        text: "Hello Editor.js HTML!",
        level: 2
      }
    },
    {
      id: "zxcvbnm456",
      type: "paragraph",
      data: {
        text: "This is an example of parsing Editor.js clean data into HTML using editorjs-html."
      }
    },
    {
      id: "lkjhgfd789",
      type: "list",
      data: {
        style: "unordered",
        items: [
          "First item",
          "Second item",
          "Third item"
        ]
      }
    }
  ]
};

const edjsParser = edjsHTML();
const htmlOutput = edjsParser.parse(editorjsData);

console.log(htmlOutput.join('\n'));
// Expected output: <h2>Hello Editor.js HTML!</h2><p>This is an example of parsing Editor.js clean data into HTML using editorjs-html.</p><ul><li>First item</li><li>Second item</li><li>Third item</li></ul>

view raw JSON →