Restructure html into contentful's rich-text model
npm install contentful-html-rich-text-converterThis package is currently still under development and in beta
Using npm:
npm install contentful-html-rich-text-converter
``
const { parseHtml } = require('contentful-html-rich-text-converter');
const html = '
a
b
c
Output:
`
{
"data": {},
"content": [
{
"data": {},
"content": [
{
"data": {},
"content": [
{
"data": {},
"marks": [],
"value": "a",
"nodeType": "text"
}
],
"nodeType": "paragraph"
}
],
"nodeType": "list-item"
},
{
"data": {},
"content": [
{
"data": {},
"content": [
{
"data": {},
"marks": [],
"value": "b",
"nodeType": "text"
}
],
"nodeType": "paragraph"
}
],
"nodeType": "list-item"
},
{
"data": {},
"content": [
{
"data": {},
"content": [
{
"data": {},
"marks": [],
"value": "c",
"nodeType": "text"
}
],
"nodeType": "paragraph"
}
],
"nodeType": "list-item"
}
],
"nodeType": "unordered-list"
}
`Current Status
$3
*