@easy-cms/richtext
v0.35.0
Published
Render Easy CMS rich text (Tiptap JSON) to safe HTML
Readme
@easy-cms/richtext
Renders Easy CMS rich text (Tiptap JSON) to safe HTML, plain text or Markdown. Part of Easy CMS, the embedded, code-first headless CMS for Nuxt and Next.js.
Install
npm install @easy-cms/richtextOr pnpm add, yarn add or bun add.
Usage
import { renderMarkdown, renderRichText, richTextToPlainText } from '@easy-cms/richtext'
const html = renderRichText(post.body) // escaped, unsafe URLs removed
const text = richTextToPlainText(post.body)
const markdown = renderMarkdown(post.body) // e.g. for llms.txt or AI assistantsSupports headings, paragraphs, bold, italic, underline, strike, code, links, lists, quotes, code
blocks, hard breaks, rules and images. Pass { nodes: { image: (node, children) => '…' } } to
customize a node. No dependencies; works in Node and browsers.
Links
Rich text · Documentation (ภาษาไทย) · GitHub
MIT License
