Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/alturosdestinations/alturos.contentfulhtmltorichtext

Convert HTML to Rich Text objects for Contentful!
https://github.com/alturosdestinations/alturos.contentfulhtmltorichtext

contentful html npm-package typescript

Last synced: 3 days ago
JSON representation

Convert HTML to Rich Text objects for Contentful!

Awesome Lists containing this project

README

        

# HTML to Contentful RichText

[![NPM version](https://img.shields.io/npm/v/contentful-html-to-richtext.svg?style=flat)](https://npmjs.org/package/contentful-html-to-richtext)

## Installation

```
npm i contentful-html-to-richtext -s
```
## Usage

This package exposes one simple method called `generateRichText`:

```javascipt
const parser = require("contentful-html-to-richtext");

let rt = parser.generateRichText(
`We link!

This a test is in text test Can we do it nested?

BIG GUY

but can we do more?`
);
console.log(JSON.stringify(rt, null, 2));
```

This should produce (if published to Contentful with `contentful-management`):
![alt text](/images/sample_output.png "sample")