Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/forgeworks/quill-delta-python
Python port of the Quill-JS Delta library - Has support for HTML Rendering
https://github.com/forgeworks/quill-delta-python
operational-transformation python quilljs
Last synced: about 1 month ago
JSON representation
Python port of the Quill-JS Delta library - Has support for HTML Rendering
- Host: GitHub
- URL: https://github.com/forgeworks/quill-delta-python
- Owner: forgeworks
- License: mit
- Created: 2017-11-22T20:05:57.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-01-18T03:10:43.000Z (almost 3 years ago)
- Last Synced: 2024-09-18T04:59:45.745Z (3 months ago)
- Topics: operational-transformation, python, quilljs
- Language: JavaScript
- Homepage:
- Size: 116 KB
- Stars: 41
- Watchers: 6
- Forks: 22
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-quill - quill-delta-python - Python implementation of Delta with an optional extension to render HTML (Uncategorized / Uncategorized)
README
# Delta (Python Port)
Python port of the javascript Delta library for QuillJS: https://github.com/quilljs/delta
Some basic pythonizing has been done, but mostly it works exactly like the above library.
There is no other python specific documentation at this time, sorry. Please see the tests
for reference examples.## Install with [Poetry](https://poetry.eustace.io/docs/#installation)
With HTML rendering:
> poetry add -E html quill-delta
Without HTML rendering:
> poetry add quill-delta
## Install with pip
Note: If you're using `zsh`, see below.
With HTML rendering:
> pip install quill-delta[html]
With HTML rendering (zsh):
> pip install quill-delta"[html]"
Without HTML rendering:
> pip install quill-delta
# Rendering HTML in Python
This library includes a module `delta.html` that renders html from an operation list,
allowing you to render Quill Delta operations in full from a Python server.For example:
from delta import html
ops = [
{ "insert":"Quill\nEditor\n\n" },
{ "insert": "bold",
"attributes": {"bold": True}},
{ "insert":" and the " },
{ "insert":"italic",
"attributes": { "italic": True }},
{ "insert":"\n\nNormal\n" },
]html.render(ops)
Result (line formatting added for readability):
Quill
Editor
bold and the italic
Normal
[See test_html.py](tests/test_html.py) for more examples.
# Developing
## Setup
If you'd to contribute to quill-delta-python, get started setting your development environment by running:Checkout the repository
> git clone https://github.com/forgeworks/quill-delta-python.git
Make sure you have python 3 installed, e.g.,
> python --version
From inside your new quill-delta-python directory:
> python3 -m venv env
> source env/bin/activate
> pip install poetry
> poetry install -E html## Tests
To run tests do:> py.test