Skip to content
aq-ui
Back to UtilitiesLibrary

Rich Text Html

Open-code aq-ui shared library for Rich Text Html.

Installation

pnpm dlx aq-ui@alpha add rich-text-html

API reference

SSR-safe

Import the parts you need, then jump to an export for its contract.

View full source

Quick start

import { generateRichTextHTML } from "@/lib/rich-text-html"

generateRichTextHTML

functionSource L14

Convert canonical Tiptap JSON to HTML without creating an editor instance.

function generateRichTextHTML(value: JSONContent, { extensions }: RichTextHTMLConversionOptions)

Parameters

NameType
valueJSONContent
optionsRichTextHTMLConversionOptions

parseRichTextHTML

functionSource L22

Parse HTML into canonical Tiptap JSON without creating an editor instance.

function parseRichTextHTML(value: string, { extensions }: RichTextHTMLConversionOptions)

Parameters

NameType
valuestring
optionsRichTextHTMLConversionOptions

RichTextHTMLConversionOptions

interfaceSource L4

Type contract for RichTextHTMLConversionOptions.

interface RichTextHTMLConversionOptions

Members

NameTypeDescription
extensionsExtensionsUse the same schema extensions that produced the document. Keeping the list explicit prevents a server conversion from silently dropping custom nodes or marks.

Package dependencies

@tiptap/core@^3.30.1, @tiptap/html@^3.30.1, happy-dom@^20.8.9

Files

  • lib/rich-text-html.ts

Source