deanblackborough/php-quill-renderer
最新稳定版本:v4.01.0
Composer 安装命令:
composer require deanblackborough/php-quill-renderer
包简介
Render quill insert deltas to HTML, Markdown and GitHub flavoured Markdown
README 文档
README
PHP Quill Renderer
Render quill insert deltas to HTML, Markdown and GitHub flavoured Markdown.
Read-only
It doesn't look like there will be new version of Quill, I've decided to make the repo read-only, I'm not going to dedicate anymore time to this package.
Description
Quill deltas renderer, converts deltas to HTML and Markdown, the Quill attributes supported are listed in the table below, the goal is to eventually support every Quill feature.
Quill is a modern WYSIWYG editor built for compatibility and extensibility.
Installation
The easiest way to use the PHP Quill Renderer is via composer.
composer require deanblackborough/php-quill-renderer,
alternatively you can include the classes in my src/ directory directly in your
library or app.
Usage
Via API, single $quill_json
try { $quill = new \DBlackborough\Quill\Render($quill_json); $result = $quill->render(); } catch (\Exception $e) { echo $e->getMessage(); } echo $result;
Via API, multiple $quill_json, passed in via array
try { $quill = new RenderMultiple($quill_json, 'HTML'); $result_one = $quill->render('one'); $result_two = $quill->render('two'); } catch (\Exception $e) { echo $e->getMessage(); } echo $result_one; echo $result_two;
Direct, parse and then render, single $quill_json - updated in v3.10.0
$parser = new \DBlackborough\Quill\Parser\Html(); $renderer = new \DBlackborough\Quill\Renderer\Html(); $parser->load($quill_json)->parse(); echo $renderer->load($parser->deltas())->render();
Direct, parse and then render, multiple $quill_json - updated in v3.10.0
$parser = new \DBlackborough\Quill\Parser\Html(); $renderer = new \DBlackborough\Quill\Renderer\Html(); $parser->loadMultiple(['one'=> $quill_json_1, 'two' => $quill_json_2)->parseMultiple(); echo $renderer->load($parser->deltasByIndex('one'))->render(); echo $renderer->load($parser->deltasByIndex('two'))->render();
Quill attributes and text flow support
| Attribute | v1+ | v2+ | v3 HTML | v3 Markdown |
|---|---|---|---|---|
| Bold | Yes | Yes | Yes | Yes |
| Italic | Yes | Yes | Yes | Yes |
| Link | Yes | Yes | Yes | Yes |
| Strike | Yes | Yes | Yes | N/A |
| Script:Sub | Yes | Yes | Yes | N/A |
| Script:Super | Yes | Yes | Yes | N/A |
| Underline | Yes | Yes | Yes | N/A |
| Header | Yes | Yes | Yes | Yes |
| Image | Yes | Yes | Yes | Yes |
| Video | No | No | Yes | Yes |
| List | Yes | Yes | Yes | Yes |
| Child lists | No | No | No | No |
| Indent/Outdent | No | No | No | No |
| Text direction | No | No | No | N/A |
| Color | No | No | No | N/K |
| Font | No | No | No | N/K |
| Text align | No | No | No | N/A |
| Block quote | No | No | No | No |
| Code block | No | No | No | No |
| Custom attributes | No | No | Yes | N/A |
| Line breaks | No | No | Yes | Yes |
| Paragraphs | Yes | Yes | Yes | Yes |
| Attribute | HTML Tag | Markdown Token |
|---|---|---|
| Bold | <strong> |
** |
| Italic | <em> |
* |
| Link | <a> |
[Text](Link) |
| Strike | <s> |
|
| Script:Sub | <sub> |
|
| Script:Super | <sup> |
|
| Underline | <u> |
|
| Header | <h[n]> |
#[n] |
| Image | <img> |
 |
| Video | <iframe> |
 |
| List | <ul> <ol> |
* & [n] |
Copyright and license
The deanblackborough/php-quill-renderer library is copyright © Dean Blackborough and licensed for use under the MIT License (MIT).
Credits
- carlos [Bugfix] v1.01.0.
- pdiveris [Issue #43] - Null inserts.
- Mark Davison - Pushed me in the right direction for v3.00.0.
- tominventisbe [Issue #54] - Parser::load() does not reset the deltas array.
- tominventisbe [Issue #55] - Image deltas with multiple attributes incorrectly being passed to Compound delta.
- bcorcoran [Issue #81] - Suggested reverting requirements to necessary requirements.
- kingga [Issue #86] - Video support.
- Jonathanm10 [Issue #87] - Newlines proceeding inserts ignored, bug report.
- raphaelsaunier [Issue #87] - Newlines proceeding inserts ignored, bug location.
- Basil [Issue #101] - Newline only inserts being ignored by parser.
- Lee Hesselden [PR #104] - Color delta to allowing spans with a style:color="#xxx" definition. (Feature will be extended by [Issue #106])
- Alex [PR #112] - Custom attributes assigned to style attribute if sensible.
- davidraijmakers [Issue #108] - Children not supported with headers.
- philippkuehn [Issue #109] - Multiple list output incorrect and paragraphs not being closed.
- mechanicalgux [Issue #117] - Compound deltas don't know that they can be links.
- Lode Claassen [PR #121] - Missing supported format in exception messages.
- Lode Claassen [PR #122] - Validation code DRY.
- Lode Claassen [PR #123] - Allow already decoded json to be passed to parser.
- Nicholas Humphries [PR #128] - Videos with attributes not supported.
- hybridvision [Issue #132] - Issue rendering single item lists when they aren't the first content.
Coding standards and documentation credits
- Lode Claassen [PR #113] - Incorrect case in keyword.
- Theo W - Readme documentation updates
deanblackborough/php-quill-renderer 适用场景与选型建议
deanblackborough/php-quill-renderer 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 215.89k 次下载、GitHub Stars 达 117, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「markdown」 「html」 「parse」 「renderer」 「quill」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 deanblackborough/php-quill-renderer 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 deanblackborough/php-quill-renderer 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 deanblackborough/php-quill-renderer 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Texy converts plain text in easy to read Texy syntax into structurally valid (X)HTML. It supports adding of images, links, nested lists, tables and has full support for CSS. Texy supports hyphenation of long words (which reflects language rules), clickable emails and URL (emails are obfuscated again
Adds more BBCode
HTML and form generation
A modern HTML DOM parser for PHP using DOMDocument and Symfony CssSelector.
Reusable utilities library for Lacus Solutions' packages (type description, HTML escaping, random sequences)
Creates a markdown changelog for your GitHub repository.
统计信息
- 总下载量: 215.89k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 118
- 点击次数: 22
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 未知