Giter Club home page Giter Club logo

php-quill-renderer's Introduction

Latest Stable Version License Minimum PHP Version Build Status

PHP Quill Renderer

Render quill insert deltas to HTML.

Description

Quill deltas renderer, converts deltas to HTML, the attributes supported by version 1.00.0 are listed below. Version 2.00.0 is in development, I'm working on support for additional Quill attributes, markdown support and a full rewrite of the parser, version 2.00.0 will only support PHP7+.

Created for use within 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>
List <ul> <ol>

Planned features for version 2.00.0

  • Parser logic rework
  • Markdown support
  • Formatting options (justification etc.)
  • Remaining Quill toolbar options
  • Full options management
  • Tests

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.