Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

codecovLicense: GPL v3

Simple PHP Parser for Editor.js

Parse to HTML clean JSON Data fromEditor.js

Installation

composer require durlecode/editorjs-simple-html-parser

Usage

useDurlecode\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();

Supported Tools

PackageKeyMain CSS Class
@editorjs/codecode.prs-code
@editorjs/embedembed.prs-embed
@editorjs/delimiterdelimiter.prs-delimiter
@editorjs/headerheader.prs-h{header-level}
@editorjs/inline-code
@editorjs/linklink.prs-link
@editorjs/listlist.prs-list
@editorjs/marker
@editorjs/paragraphparagraph.prs-paragraph
@editorjs/rawraw
@editorjs/simple-imagesimpleImage.prs-image
@editorjs/warningwarning.prs-warning

Methods

toHtml()

Return generated HTML

setPrefix(string $prefix)

Set CSS classes Prefix

getPrefix()

Return current prefix

getVersion()

Return Editor.js content version

getTime()

Return Editor.js content timestamp

getBlocks()

Return Editor.js content blocks

Generated HTML

Code
<divclass="prs-code"><pre><code></code></pre></div>
Embed
(Actually working with Youtube, Codepen & Gfycat)
<divclass="prs-embed"><iframesrc=""height="300"></iframe></div>
Delimiter
<hrclass="prs-delimiter">
Header
<h2class="prs-h2">Lorem</h2>
Link
<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>
Ordered List
<divclass="prs-list"><ol><li></li></ol></div>
Unordered List
<divclass="prs-list"><ul><li></li></ul></div>
Paragraph
<pclass="prs-paragraph"><codeclass="inline-code">Pellentesque</code><i>malesuada fames</i><markclass="cdx-marker">tempus</mark></p>
Image
<figureclass="prs-image"><imgsrc=""class="prs-image-border prs-image-background"alt=""><figcaption></figcaption></figure>
Warning
<divclass="prs-warning"><ion-iconname="information-outline"size="large"aria-label="information outline"></ion-icon><div><p>Title</p><p>Message</p></div></div>
Raw
<divclass="prs-raw">    Raw HTML ...</div>

About

A simple html parser write in php for Editor.js

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors2

  •  
  •  

Languages


[8]ページ先頭

©2009-2025 Movatter.jp