Render quill insert deltas to HTML
PHP
Latest commit 226548f Jun 6, 2017 @deanblackborough committed on GitHub Merge pull request #26 from deanblackborough/v0.90-take-2
V0.90 take 2
Permalink
Failed to load latest commit information.
example Paragraph support Jun 6, 2017
src Paragraph support Jun 6, 2017
tests Paragraph support Jun 6, 2017
.gitattributes Normalize line endings Feb 24, 2017
.gitignore Newline trimmed Feb 26, 2017
.travis.yml Tests Apr 19, 2017
CHANGELOG.md Paragraph support Jun 6, 2017
LICENSE Initial commit Feb 24, 2017
README.md Paragraph support Jun 6, 2017
composer.json Autoload Apr 25, 2017
composer.lock Tests Mar 26, 2017

README.md

Latest Stable Version License Minimum PHP Version Build Status

PHP Quill Renderer

Render quill insert deltas to HTML.

Description

Simple Quill delta insert renderer, currently it only supports the attributes listed below, I will add support for additional attributes as I need them in Dlayer.

Created for use in Dlayer but works as a stand-alone tool.

Installation

The easiest way to use the renderer is with composer. composer require deanblackborough/php-quill-renderer, alternatively include the classes in src/ in your library.

Usage

try {
    $quill = new \DBlackborough\Quill\Render($deltas, 'HTML');
    echo $quill->render();
} catch (\Exception $e) {
    echo $e->getMessage();
}

Usage, direct, parse and then render

$parser = new \DBlackborough\Quill\Parser\Html();
$parser->load($deltas);
$parser->parse();

$renderer = new \DBlackborough\Quill\Renderer\Html($parser->content());
echo $renderer->render();

Options

The HTML tag to use for Quill attributes can be set along with the HTML tags for the container.

Default options

Separator HTML Tag
Container <p>

Default attribute options

Quill Attribute HTML Tag
Bold <strong>
Italic <em>
Link <a>
Strike <s>
Script:Sub <sub>
Script:Super <sup>
Underline <u>
Header <h[n]>
Image <img>

Planned features

  • Markdown support
  • Lists (Bullets and Ordered)
  • Formatting options (justification etc.)
  • Remaining toolbar options
  • Missing tests (options)

Warnings

Image support

The image support is rudimentary; it isn't production ready, some work needs to be done to support images. I can think of two solutions, pre-save of deltas, post the base64 and return a URI to replace the base64, or, at render time, fetch/cache an image/URI by posting the base64, later down the line I may explore one of these options.

Why?

I'm using this package within Dlayer, my app has its own image handling and I will not be exposing the image functionality of Quill.