
Product
Reachability for Ruby Now in Beta
Reachability analysis for Ruby is now in beta, helping teams identify which vulnerabilities are truly exploitable in their applications.
@contentful/rich-text-plain-text-renderer
Advanced tools
Plain text renderer for the Rich Text document.
Using npm:
npm install @contentful/rich-text-plain-text-renderer
Using yarn:
yarn add @contentful/rich-text-plain-text-renderer
import { documentToPlainTextString } from '@contentful/rich-text-plain-text-renderer';
const document = {
nodeType: 'document',
data: {},
content: [
{
nodeType: 'paragraph',
data: {},
content: [
{
nodeType: 'text',
value: 'Hello',
marks: [{ type: 'bold' }],
data: {},
},
{
nodeType: 'text',
value: ' world!',
marks: [{ type: 'italic' }],
data: {},
},
],
},
],
};
documentToPlainTextString(document); // -> Hello world!
The `html-to-text` package converts HTML content into plain text. It is more general-purpose compared to @contentful/rich-text-plain-text-renderer, which is specifically designed for Contentful's rich text format. However, `html-to-text` can be used for a wider range of HTML content.
The `turndown` package is a highly customizable HTML to Markdown converter. While it focuses on converting HTML to Markdown, it can also be used to strip HTML tags and extract plain text. This makes it a versatile tool for text extraction, though it is not specifically tailored for Contentful's rich text format.
The `sanitize-html` package is used to clean up and sanitize HTML content by removing unwanted tags and attributes. While its primary purpose is to sanitize HTML, it can also be configured to strip all tags, effectively converting HTML to plain text. This package offers more control over the sanitization process compared to @contentful/rich-text-plain-text-renderer.
FAQs
Plain text renderer for the Rich Text document.
We found that @contentful/rich-text-plain-text-renderer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Reachability analysis for Ruby is now in beta, helping teams identify which vulnerabilities are truly exploitable in their applications.

Research
/Security News
Malicious npm packages use Adspect cloaking and fake CAPTCHAs to fingerprint visitors and redirect victims to crypto-themed scam sites.

Security News
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.