kontent-ai / kontent-delivery-node-parser

Rich text element parser for node.js & javascript delivery SDK.
MIT License
0 stars 2 forks source link
kontent kontent-ai kontent-ai-tool kontent-delivery kontent-parser rich-text-element

Node.js parser for Rich text elements

This library is an optional addon for the javascript delivery SDK that can be used to resolve rich text elements in node.js environment.

This is an alternative to built-in browserParser that comes native with the SDK and works in browsers.

Usage

import { createRichTextHtmlResolver, createAsyncRichTextHtmlResolver } from '@kontent-ai/delivery-sdk';
import { nodeParser, asyncNodeParser } from '@kontent-ai/delivery-node-parser';

// transform rich text html into json
const json = createRichTextHtmlResolver(nodeParser).resolveRichText(data);

// or
const html = await createAsyncRichTextHtmlResolver(asyncNodeParser).resolveRichText(data);