Skip to main content

A little library for simplifying and transforming HTML into structured data

Works with
JSR Score
58%
Published
2 months ago (0.0.3)

Structured HTML

A little library for simplifying and transforming HTML into structured data

Usage

While designed around the EditorJS API, the library may be used for just transforming HTML content into structured/block-based content for a variety of purposes

The conversion from HTML can be done as follows:

import { convertHtmlToStructuredContent } from "@sftsrv/structured-html";

// get some RAW HTML
const htmlText = "<p>hello world</p>";

// use the DOM to parse it from a string
const html = new DOMParser().parseFromString(htmlText, "text/html").body;

// the convertHtmlToStructuredContent function takes an HTML ELement and returns the structured HTML content
const blocks = convertHtmlToStructuredContent(html);
Built and signed on
GitHub Actions
View transparency log

Add Package

deno add @sftsrv/structured-html

Import symbol

import * as mod from "@sftsrv/structured-html";

Add Package

npx jsr add @sftsrv/structured-html

Import symbol

import * as mod from "@sftsrv/structured-html";

Add Package

yarn dlx jsr add @sftsrv/structured-html

Import symbol

import * as mod from "@sftsrv/structured-html";

Add Package

pnpm dlx jsr add @sftsrv/structured-html

Import symbol

import * as mod from "@sftsrv/structured-html";

Add Package

bunx jsr add @sftsrv/structured-html

Import symbol

import * as mod from "@sftsrv/structured-html";