@contentful/rich-text-plain-text-renderer--demo
v6.0.0
Published
Plain text renderer for the Rich Text document.
Downloads
5
Keywords
Readme
rich-text-plain-text-renderer--demo
Plain text renderer for the Rich Text document.
Installation
Using npm:
npm install @contentful/rich-text-plain-text-renderer--demo
Using yarn:
yarn add @contentful/rich-text-plain-text-renderer--demo
Usage
import { documentToPlainTextString } from '@contentful/rich-text-plain-text-renderer--demo';
const document = {
nodeType: 'document',
nodeClass: 'document',
content: [
{
nodeClass: 'block',
nodeType: 'paragraph',
content: [
{
nodeClass: 'text',
nodeType: 'text',
value: 'Hello',
marks: [{ nodeType: 'bold' }]
},
{
nodeClass: 'text',
nodeType: 'text',
value: ' world!',
marks: [{ nodeType: 'italic' }]
},
],
},
]
};
documentToPlainTextString(document); // -> Hello world!