@contentful/rich-text-plain-text-renderer--demo
TypeScript icon, indicating that this package has built-in type declarations

6.0.0 • Public • Published

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!

Dependents (0)

Package Sidebar

Install

npm i @contentful/rich-text-plain-text-renderer--demo

Weekly Downloads

3

Version

6.0.0

License

MIT

Unpacked Size

21.9 kB

Total Files

10

Last publish

Collaborators

  • michaelpearce
  • it-internal
  • whydah-gally
  • contentful-ecosystem