An open API service indexing awesome lists of open source software.

https://github.com/beapi/gutenberg-serializer

Package to transform Gutenberg block array to a Gutenberg firendly string
https://github.com/beapi/gutenberg-serializer

Last synced: 8 months ago
JSON representation

Package to transform Gutenberg block array to a Gutenberg firendly string

Awesome Lists containing this project

README

          

# gutenberg-serializer
Package to transform Gutenberg block array to a Gutenberg firendly string

# Purpose
This package allows you to use a block array from "parse_blocs" for example, and serialize it into Gutenberg compatible content.
This can be used to migrate content from blocs or programmatically generate content for Gutenberg.
The library supports innerBlocs.

# Example
```php
$bloc = [
[
'blockName' => 'core/paragraph',
'attrs' =>
[
'id' => 4
],
'innerBlocks' => [],
'innerHTML' => '

This is a content


',
'innerContent' => [
0 => '

This is a content


',
],
]
];
$content = BlocksSerializer::from_array( $bloc );
```

Will become :
```

This is a content

```

# Commands
You have commands into the project :
- `composer cs` : Check the coding standards
- `composer cbf` : Beautify automatically all the files of the project
- `composer test` : Launch the tests
- `composer psalm`: Launch psalm on the files