@teclone/prismic-richtext
v2.5.2
Published
Convert Rich Text raw data to generic tree to simplify serialization, with ability to pass down parent node props to child nodes
Downloads
105
Readme
Prismic RichText
A helper to build generic tree from rich text raw json
Get a generic tree from a richtext
import { asTree } from '@teclone/prismic-richtext';
asTree(doc.data.myRichText);
Get a serialized tree from a richtext
You can find an example here: https://github.com/prismicio/prismic-dom/blob/master/src/index.js
import {serialize} from '@teclone/prismic-richtext';
// define a serialize function to manage your fragment
// you can use the 'Element' Helper from PrismicRichText to match the different fragments
function customSerializer() {...}
serialize(doc.data.myRichText, customSerializer, htmlSerializer)