Takes ProseMirror JSON and outputs HTML.
composer require scrumpy/prosemirror-to-html
(new \Scrumpy\ProseMirrorToHtml\Renderer)->render([
'type' => 'doc',
'content' => [
[
'type' => 'paragraph',
'content' => [
[
'type' => 'text',
'text' => 'Example Paragraph',
],
],
],
],
])
<p>Example Text</p>
Define your custom nodes as PHP classes:
<?php
class CustomNode extends \Scrumpy\ProseMirrorToHtml\Nodes\Node
{
public function matching()
{
return $this->node->type === 'custom';
}
public function tag()
{
return 'marquee';
}
}
And register them:
$renderer->addNode(CustomNode::class);
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.