Skip to main content

Draft.js exporter

Library to convert rich text from Draft.js raw ContentState to HTML.

Features

This project adheres to Semantic Versioning, and measures performance and code coverage. Code is checked with mypy.

  • Extensive configuration of the generated HTML.
  • Default, extensible block & inline style maps for common HTML elements.
  • Convert line breaks to <br> elements with decorators.
  • Define any attribute in the block map – custom class names for elements.
  • React-like API to create custom components.
  • Automatic conversion of entity data to HTML attributes (int & boolean to string, style object to style string).
  • Nested lists (<li> elements go inside <ul> or <ol>, with multiple levels).
  • Output inline styles as inline elements (<em>, <strong>, pick and choose, with any attribute).
  • Overlapping inline style and entity ranges.
  • Static type annotations.

It is developed alongside the Draftail rich text editor, for Wagtail. Check out the online demo, and our introductory blog post.

When to use the exporter

Draft.js is a rich text editor framework for React. Its approach is different from most rich text editors because it does not store data as HTML, but rather in its own representation called ContentState. This exporter is useful when the ContentState to HTML conversion has to be done in a Python ecosystem.

The initial use case was to gain more control over the content managed by rich text editors in a Wagtail/Django site. If you want to read the full story, have a look at our blog post: Rethinking rich text pipelines with Draft.js.

Documentation

The full documentation is available at on the docs website. For LLM-assisted tooling, there is also a concise llms.txt and a complete llms-full.txt.

Contributing

See anything you like in here? Anything missing? We welcome all support, whether on bug reports, feature requests, code, design, reviews, tests, documentation, and more. Please have a look at our contribution guidelines.

Credits

Draftail was created by Springload, and is now maintained by Wagtail contributors. View the full list of contributors. MIT licensed.

Metadata

Release files for draftjs_exporter 7.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for draftjs_exporter 7.3.0
File Size Uploaded Provenance
draftjs_exporter-7.3.0.tar.gz 60.6 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for draftjs_exporter 7.3.0
File Interpreter ABI Platform
draftjs_exporter-7.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 135.8 kB

Release files / draftjs_exporter-7.3.0.tar.gz

Download URL draftjs_exporter-7.3.0.tar.gz
Size 60.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ef6d9d23d15f370497c91b846636a48ff1eb114e3473ebbd7f76af2629d75953
BLAKE2b-256 checksum
How to use checksums
d03e171ffe02001614e617de32f84513dfdb41ec8559c4caa64c45af8ca6b41c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.

Transparency log

Release files / draftjs_exporter-7.3.0-py3-none-any.whl

Download URL draftjs_exporter-7.3.0-py3-none-any.whl
Size 75.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7fb726a7ba3304c785893ed191797abc62d42147b97370bf4e4603c6a0d45830
BLAKE2b-256 checksum
How to use checksums
1c8c6189ac533fc8e3bea1f22bad81772c48a18fbe77723eddf339f4382f3857
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.

Transparency log

Security for draftjs_exporter 7.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for draftjs_exporter-7.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

7.3.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page