This repository has been migrated to a new organization (Read more: ueberdosis/tiptap#759)
Takes ProseMirror JSON and outputs HTML.
composer require ueberdosis/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
- Strike
- Subscript
- Superscript
- Underline
Define your custom nodes as PHP classes:
<?php
class CustomNode extends \Scrumpy\ProseMirrorToHtml\Nodes\Node
{
protected $markType = 'custom';
protected $tagName = 'marquee';
}
And register them:
$renderer->addNode(CustomNode::class);
Or overwrite the enabled nodes:
$renderer->withNodes([
CustomNode::class,
]);
Or overwrite the enabled marks:
$renderer->withMarks([
Bold::class,
]);
Pull Requests are welcome.
The MIT License (MIT). Please see License File for more information.