Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Gutenberg to React

This package allows you to convert Wordpress Gutenbergs post_content field on the post object to a ReactJs tree.

CircleCI

Why

Madness.

Install

npm install @threemammals/gutenberg-to-react

How To

const { gutenbergToReact } = require('@threemammals/gutenberg-to-react');

// example of Wordpress Gutenberg post_content from the post object
const input = '<!-- wp:paragraph -->\n<p>text <br></p>\n<!-- /wp:paragraph -->';

// parse to ReactJs tree
const result = gutenbergToReact(input);

// check out your ReactJs tree?!?!?
console.log(result);
[
  {
    type: 'core/paragraph',
    ref: null,
    '$$typeof': Symbol(react.element),
    props: { style: {}, className: null, children: [Array] }
  }
]

About

Parse Wordpress Gutenberg post_content to a React tree

Topics

Resources

Packages

No packages published