Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rich-text-to-html

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rich-text-to-html - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

2

package.json
{
"name": "rich-text-to-html",
"version": "1.0.0",
"version": "1.0.1",
"description": "return html string from contentful rich text fieild",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -1,1 +0,105 @@

# rich-text-to-html
# rich-text-to-html
HTML renderer for the Contentful rich text field type **with Embed**.
## Installation
```sh
$ npm install rich-text-to-html
```
## Usage
```javascript
import richTextToHtmlString from 'rich-text-to-html';
const document = {
nodeType: "document",
data: {},
content: [
{
nodeType: "heading-2",
content: [
{
nodeType: "text",
value: "Block title",
marks: [],
data: {}
}
],
data: {}
},
{
nodeType: "paragraph",
content: [
{
nodeType: "text",
value: "custom text",
marks: [],
data: {}
}
],
data: {}
},
{
nodeType: "embedded-asset-block",
content: [],
data: {
target: {
metadata: {
tags: []
},
sys: {
space: {
sys: {
type: "Link",
linkType: "Space",
}
},
type: "Asset",
createdAt: "2022-03-03T13:21:41.509Z",
updatedAt: "2022-03-03T13:21:41.509Z",
environment: {
sys: {
id: "master",
type: "Link",
linkType: "Environment"
}
},
revision: 1,
locale: "en-US"
},
fields: {
title: "Banner",
description: "",
file: {
url: "//images.ctfassets.net/.../image.webp",
details: {
size: 16652,
image: {
width: 940,
height: 150
}
},
fileName: "image.webp",
contentType: "image/webp"
}
}
}
}
},
{
nodeType: "paragraph",
content: [
{
nodeType: "text",
value: "custom text",
marks: [],
data: {}
}
],
data: {}
}
]
};
richTextToHtmlString(document); // -> <h2>Casino ads</h2><p>custom text</p><img alt="Banner" src="https://images.ctfassets.net/.../image.webp"><p>custom text</p>
```
<br>
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc