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.

Release files for draftjs_exporter 6.0.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 6.0.0
File Size Uploaded Provenance Actions
draftjs_exporter-6.0.0.tar.gz 27.6 kB Without provenance Details for draftjs_exporter-6.0.0.tar.gz

Built distribution (wheel)

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

Total release size: 67.4 kB

Release files / draftjs_exporter-6.0.0.tar.gz

Download URL draftjs_exporter-6.0.0.tar.gz
Size 27.6 kB
Tags Source
SHA-256 checksum
How to use checksums
09d0249f7342f41d58854840e72251c7485223a8351ac02675a920ae0d6991c0
BLAKE2b-256 checksum
How to use checksums
a31193626518e3e9747cca66a2e5136689f1347d03c3eeb05eaafaffac9e3c6a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

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

Download URL draftjs_exporter-6.0.0-py3-none-any.whl
Size 39.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1f1bd07a0f7f1a2107a1c449d6d5a6889f4c29ca0192169d56c732ca58498c8e
BLAKE2b-256 checksum
How to use checksums
5a7d7c2e275b83a8347026a3f5f278dd26805a474fb36af2ffb75fc086b953f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for draftjs_exporter 6.0.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

6.0.0 This release

2 release files No 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