Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 4 months ago
JSON representation
Convert HTML to Rich Text objects for Contentful!
- Host: GitHub
- URL: https://github.com/alturosdestinations/alturos.contentfulhtmltorichtext
- Owner: AlturosDestinations
- License: mit
- Created: 2019-06-26T14:15:18.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-08-11T06:18:34.000Z (over 3 years ago)
- Last Synced: 2024-10-14T02:41:46.711Z (4 months ago)
- Topics: contentful, html, npm-package, typescript
- Language: TypeScript
- Homepage:
- Size: 49.8 KB
- Stars: 6
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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
```
## UsageThis 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")