1. Go to this page and download the library: Download sqkhor/editorjs-html library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
sqkhor / editorjs-html example snippets
// Get an array of HTML based on original blocks
$result = edjsHTML::parse($editorjs_clean_data);
// Enclose in <section> for display
$sections = array_map(function ($section) {
return "<section>$section</section>";
}, $result);
// Join for output
$html = implode("", $sections);
echo $html;
$HTML = edjsHTML::parse($editorjs_data);
// returns an array of html strings per block
var_export($HTML);
try {
$HTML = edjsHTML::parse_strict($editorjs_data);
// in case of success, returns an array of strings
var_export($HTML)
} catch (\Exception $e) {
// returns an error when data is invalid
}
$block_HTML = edjsHTML::parse_block($editorjs_data_block);
// returns a string of html for this block
var_export(block_HTML);
// returns a list of missing parser functions
$block_HTML = edjsHTML::validate($editorjs_data);
var_export(block_HTML);
// Parse this block in editorjs-html
class CustomParser extends edjsHTML {
static public function custom ($block) {
return "<div class=\"custom-block\">{$block['data']['text']}</div>";
}
}
const HTML = CustomParser::parse($editorjs_data);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.