Skip to main content

Python port of the quill.js delta library that enables operational transformation with aditional functionality for rendering html

Project description

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

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):

<p>Quill</p>
<p>Editor</p>
<p><br></p>
<p><strong>bold</strong> and the <em>italic</em></p>
<p><br></p>
<p>Normal</p>

See 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

quill-delta-1.0.1.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

quill_delta-1.0.1-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file quill-delta-1.0.1.tar.gz.

File metadata

  • Download URL: quill-delta-1.0.1.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.15 CPython/3.7.2 Darwin/18.0.0

File hashes

Hashes for quill-delta-1.0.1.tar.gz
Algorithm Hash digest
SHA256 1e9f57bfdfe184cae742c2e838b26b66c7c1d01cbc9c83d57a5dcb3d21c2e913
MD5 261161cd68ac873bcbe1f6ff460fc008
BLAKE2b-256 5fbb0185656e4f14624ab6c68585c9f064854fa82534445ac2120e7eb30f36f0

See more details on using hashes here.

File details

Details for the file quill_delta-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: quill_delta-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.15 CPython/3.7.2 Darwin/18.0.0

File hashes

Hashes for quill_delta-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fa89cf3bcdf797bbdbe79ba3bd39d86ce1d8b6810e82e0ffbf6b2541bb685326
MD5 f5d985236d8b8252f2a2a2d78d7b3d61
BLAKE2b-256 1f60e5740caaf53dd0060809946aa811977a2f10cdd8784b9be88fc143145c07

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page