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

0.0.0-determined-by-semantic-release • 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!

Dependencies (5)

Dev Dependencies (35)

Package Sidebar

Install

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

Weekly Downloads

7

Version

0.0.0-determined-by-semantic-release

License

MIT

Unpacked Size

22.1 kB

Total Files

10

Last publish

Collaborators

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