Skip to content

Archakov06/codex-to-html

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Codex To HTML

Class for converting JSON-blocks EditorJS to HTML.

How to use?

Create an instance of the class with prepared settings for each block and call the render method (put JSON-blocks).

Example

<?php
require './codex.php';

$codex = new CodexToHtml([
    'raw' => function($html) {
        return $html;
    },
    'header' => function($text, $level) {
        return "<h${level}>${text}</h${level}>";
    },
    'paragraph' => function($text) {
        return "<p>{$text}</p>";
    },
    'image' => function($file, $caption, $widthBorder, $stretched, $withBackground) {
        return "<img src=\"{$file['url']}\" title=\"{$caption}\" alt=\"{$caption}\">";
    },
]);

// $blocks - JSON состоящий из блоков-компонентов Codex Editor

$codex->render($blocks);

License

MIT © Archakov Dennis

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages