https://github.com/threemammals/gutenberg-to-react
Parse Wordpress Gutenberg post_content to a React tree
https://github.com/threemammals/gutenberg-to-react
gutenberg react reactjs wordpress
Last synced: about 1 year ago
JSON representation
Parse Wordpress Gutenberg post_content to a React tree
- Host: GitHub
- URL: https://github.com/threemammals/gutenberg-to-react
- Owner: ThreeMammals
- Created: 2019-11-08T19:53:45.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T13:00:37.000Z (over 3 years ago)
- Last Synced: 2024-03-25T21:30:40.534Z (about 2 years ago)
- Topics: gutenberg, react, reactjs, wordpress
- Language: JavaScript
- Homepage: https://threemammals.com
- Size: 734 KB
- Stars: 6
- Watchers: 3
- Forks: 2
- Open Issues: 26
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Gutenberg to React
This package allows you to convert Wordpress Gutenbergs post_content field on the post object to a ReactJs tree.
[](https://circleci.com/gh/ThreeMammals/gutenberg-to-react/tree/master)
## Why
Madness.
## Install
`npm install @threemammals/gutenberg-to-react`
## How To
```javascript
const { gutenbergToReact } = require('@threemammals/gutenberg-to-react');
// example of Wordpress Gutenberg post_content from the post object
const input = '\n
text
\n';
// 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] }
}
]
```