Skip to content

About

Convert HTML to Rich Text objects for Contentful!

Topics

Resources

Stars

7 stars

Watchers

1 watching

Forks

Latest commit

 

History

10 Commits

Folders and files

Repository files navigation

HTML to Contentful RichText

NPM version

Installation

npm i contentful-html-to-richtext -s

Usage

This package exposes one simple method called generateRichText:

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

let rt = parser.generateRichText(
  `<a href='mailto:test'>We link!</a>
   <p>This a test is <a href='mailto:test'>in text</a> test <b>Can we do it nested?</b> </p> <h1>BIG GUY</h1> but can we do more?`
);
console.log(JSON.stringify(rt, null, 2));

This should produce (if published to Contentful with contentful-management): alt text

About

Convert HTML to Rich Text objects for Contentful!

Topics

Resources

Stars

7 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages