A high-performance PHP library to convert Markdown text into Quill Delta format.
- ✅ Checkboxes (Task lists)
- ✅ Nested Lists (with indentation)
- ✅ Reference-style Links
- ✅ Tables (GFM)
- ✅ Definition Lists
- ✅ Footnotes
- ✅ Abbreviations
- ✅ Highlight (
==), Subscript (~), Superscript (^) - ✅ Emoji (
:smile:) - ✅ Paragraphs
- ✅ Headers (H1-H6)
- ✅ Text formatting (bold, italic, inline code, strikethrough)
- ✅ Code blocks
- ✅ Blockquotes
- ✅ Ordered and unordered lists
- ✅ Links
- ✅ Images
- ✅ Nested formatting
Install the package via Composer:
composer require taoshan98/markdown-to-quill-delta<?php
require_once 'vendor/autoload.php';
use MarkdownToQuill\Converter;
$markdown = "# Hello World\n\nThis is **bold** and this is *italic*.";
$converter = new Converter();
$ops = $converter->convert($markdown);
// Output as JSON
echo json_encode($ops, JSON_PRETTY_PRINT);// api/convert.php
require_once '../vendor/autoload.php';
use MarkdownToQuill\Converter;
header('Content-Type: application/json');
// Receive markdown from POST
$markdown = file_get_contents('php://input');
// Convert
$converter = new Converter();
$ops = $converter->convert($markdown);
// Respond with JSON
echo json_encode([
'success' => true,
'delta' => $ops
]);| Markdown | Result |
|---|---|
# Heading |
Header level 1 |
**bold** |
Bold |
*italic* |
Italic |
`code` |
Inline code |
~~strike~~ |
Strikethrough |
- item |
Unordered list |
1. item |
Ordered list |
- [ ] item |
Checkbox (unchecked) |
- [x] item |
Checkbox (checked) |
> quote |
Blockquote |
```code``` |
Code block |
[text](url) |
Link |
 |
Image |
# H1
## H2
### H3
#### H4
##### H5
###### H6**bold** or __bold__
*italic* or _italic_
`inline code`
~~strikethrough~~Unordered lists:
- Item 1
- Item 2
* Item 3
+ Item 4Ordered lists:
1. First
2. Second
3. Third- [ ] To do
- [x] Done> This is a blockquote
> On multiple lines```javascript
function hello() {
console.log("Hello!");
}
```[Link text](https://example.com)
Markdown Input:
Hello World
Delta JSON Output:
[
{
"insert": "Hello World"
},
{
"insert": "\n"
}
]Markdown Input:
# Welcome
This document has **bold text**, *italic text*, and `inline code`.
Delta JSON Output:
[
{
"insert": "Welcome"
},
{
"insert": "\n",
"attributes": {
"header": 1
}
},
{
"insert": "This document has "
},
{
"insert": "bold text",
"attributes": {
"bold": true
}
},
{
"insert": ", "
},
{
"insert": "italic text",
"attributes": {
"italic": true
}
},
{
"insert": ", and "
},
{
"insert": "inline code",
"attributes": {
"code": true
}
},
{
"insert": ".\n"
}
]Run tests with PHPUnit:
composer install
./vendor/bin/phpunit testsThe Delta format is a JSON format that describes the content and formatting of Quill documents. Each operation (op) in the delta can be:
- insert: The content to insert (text or embeds like images)
- attributes: Formatting attributes applied to the insert
Example:
[
{
"insert": "Normal text"
},
{
"insert": "Bold text",
"attributes": {
"bold": true
}
}
]This project is licensed under the BSD-3-Clause License.
PHP port based on the original JavaScript library md-to-quill-delta.