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>
- Blockquote
- BulletList
- CodeBlock
- HardBreak
- Heading
- ListItem
- OrderedList
- Paragraph
- Table
- TableRow
- TableHeader
- TableCell
- Bold
- Code
- Italic
- Link
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);
Pull Requests are welcome.
The MIT License (MIT). Please see License File for more information.