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.
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);