Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 10 days 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 (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T13:00:37.000Z (almost 2 years ago)
- Last Synced: 2024-03-25T21:30:40.534Z (8 months 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.
[![CircleCI](https://circleci.com/gh/ThreeMammals/gutenberg-to-react/tree/master.svg?style=svg)](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 = '\ntext
\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] }
}
]
```