- Notifications
You must be signed in to change notification settings - Fork14
A simple html parser write in php for Editor.js
License
NotificationsYou must be signed in to change notification settings
Durlecode/editorjs-simple-html-parser
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Parse to HTML clean JSON Data fromEditor.js
composer require durlecode/editorjs-simple-html-parseruseDurlecode\EJSParser\Parser;$html = Parser::parse($data)->toHtml();
Where$data is the clean JSON data coming from Editor.jsSee$data example below
{"time" :1583848289745,"blocks" : [ {"type" :"header","data" : {"text" :"Hello World","level" :2 } } ],"version" :"2.16.1"}By default this will generate html with css classes withprs prefix, so if you want to change it, follow example below
useDurlecode\EJSParser\Parser;$parser =newParser($data);$parser->setPrefix("cat");$parsed =$parser->toHtml();
| Package | Key | Main CSS Class |
|---|---|---|
@editorjs/code | code | .prs-code |
@editorjs/embed | embed | .prs-embed |
@editorjs/delimiter | delimiter | .prs-delimiter |
@editorjs/header | header | .prs-h{header-level} |
@editorjs/inline-code | ||
@editorjs/link | link | .prs-link |
@editorjs/list | list | .prs-list |
@editorjs/marker | ||
@editorjs/paragraph | paragraph | .prs-paragraph |
@editorjs/raw | raw | |
@editorjs/simple-image | simpleImage | .prs-image |
@editorjs/warning | warning | .prs-warning |
Return generated HTML
Set CSS classes Prefix
Return current prefix
Return Editor.js content version
Return Editor.js content timestamp
Return Editor.js content blocks
<divclass="prs-code"><pre><code></code></pre></div>
<divclass="prs-embed"><iframesrc=""height="300"></iframe></div>
<hrclass="prs-delimiter">
<h2class="prs-h2">Lorem</h2>
<ahref="https://github.com/"target="_blank"class="prs-link"><divclass="prs-link-container-with-img"><divclass="prs-link-title">Title</div><divclass="prs-link-description">Description</div><divclass="prs-link-url">https://example.com/</div></div><divclass="prs-link-img-container"><imgsrc="https://example.com/cat.png"alt=""></div></a>
<divclass="prs-list"><ol><li></li></ol></div>
<divclass="prs-list"><ul><li></li></ul></div>
<pclass="prs-paragraph"><codeclass="inline-code">Pellentesque</code><i>malesuada fames</i><markclass="cdx-marker">tempus</mark></p>
<figureclass="prs-image"><imgsrc=""class="prs-image-border prs-image-background"alt=""><figcaption></figcaption></figure>
<divclass="prs-warning"><ion-iconname="information-outline"size="large"aria-label="information outline"></ion-icon><div><p>Title</p><p>Message</p></div></div>
<divclass="prs-raw"> Raw HTML ...</div>
About
A simple html parser write in php for Editor.js
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
No releases published
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.