blocknote-py


Nameblocknote-py JSON
Version 0.3.1 PyPI version JSON
download
home_pageNone
Summary๐Ÿš€ BlockNote Python library - Convert BlockNote.js blocks to HTML, Markdown, PDF & JSON. Type-safe Pydantic models for Django, FastAPI, Flask backends. Rich text editor content processing made easy.
upload_time2025-10-28 20:53:22
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseMIT License Copyright (c) 2025 Rohan Sharma Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords api block-note blocknote blocknote-py blocknote-python blocknotejs blog cms content-api content-conversion content-management django document-processing documentation editor-backend fastapi flask headless-cms html json markdown markup-converter pdf pydantic python-backend rest-api rich-text server-side-rendering structured-content text-editor web-development wysiwyg
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # BlockNote-py ๐Ÿš€ - BlockNote Python Library

[![PyPI version](https://badge.fury.io/py/blocknote-py.svg)](https://pypi.org/project/blocknote-py/)
[![Python Support](https://img.shields.io/pypi/pyversions/blocknote-py.svg)](https://pypi.org/project/blocknote-py/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Documentation](https://img.shields.io/badge/docs-available-brightgreen.svg)](https://rohansharmasitoula.github.io/blocknote-py/)
[![CI](https://github.com/rohansharmasitoula/blocknote-py/workflows/CI/badge.svg)](https://github.com/rohansharmasitoula/blocknote-py/actions)
[![Downloads](https://pepy.tech/badge/blocknote-py)](https://pepy.tech/project/blocknote-py)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/blocknote-py)](https://pypi.org/project/blocknote-py/)
[![GitHub stars](https://img.shields.io/github/stars/rohansharmasitoula/blocknote-py)](https://github.com/rohansharmasitoula/blocknote-py)

> **๐ŸŽฏ BlockNote Python Library** - Convert [BlockNote.js](https://www.blocknotejs.org/) blocks to HTML, Markdown, PDF & JSON with type-safe Pydantic models. Perfect for Django, FastAPI, Flask backends and headless CMS applications. Server-side BlockNote content processing made simple.

## ๐Ÿค” Why BlockNote-py?

**BlockNote-py** is the missing piece for Python developers who want to work with [BlockNote.js](https://www.blocknotejs.org/) content on the server-side. Whether you're building a Django blog, FastAPI content API, or Flask CMS, BlockNote-py provides seamless integration with Python backends.

### ๐ŸŽฏ Perfect For:
- **Django Developers**: Process BlockNote content in Django models and views
- **FastAPI APIs**: Build content APIs with automatic validation and serialization  
- **Flask Applications**: Add rich text processing to Flask apps
- **Headless CMS**: Convert editor content to multiple formats
- **Content Migration**: Batch process and convert existing content
- **PDF Reports**: Generate professional documents from editor content

## โœจ Features

- ๐Ÿ”„ **Multiple Format Support**: HTML, Markdown, PDF, and Dictionary conversion
- ๐ŸŒ **HTML Conversion**: Full bidirectional HTML support with styling preservation
- ๐Ÿ“ **Markdown Support**: Convert to/from Markdown with formatting
- ๐Ÿ“„ **PDF Generation**: Convert BlockNote blocks to professional PDF documents with WeasyPrint
- ๐Ÿ›ก๏ธ **Type Safety**: Built with Pydantic v2 for robust data validation and IDE support
- ๐ŸŽจ **Rich Formatting**: Bold, italic, colors, lists, quotes, headings, and more
- ๐Ÿงช **Well Tested**: Comprehensive test suite with 88+ tests and 95% coverage
- ๐Ÿ“š **Great Documentation**: Detailed docs with real-world examples
- โšก **Fast & Lightweight**: Minimal dependencies, maximum performance
- ๐Ÿ”ง **Framework Agnostic**: Works with any Python web framework

## ๐Ÿ“ฆ Installation

### Basic Installation
```bash
pip install blocknote-py
```

### With PDF Support
```bash
pip install 'blocknote-py[pdf]'
```

### Full Installation (all features)
```bash
pip install 'blocknote-py[all]'
```

## ๐Ÿš€ Quick Start

```python
from blocknote.converter import blocks_to_html, blocks_to_markdown, blocks_to_pdf
from blocknote.schema import Block, InlineContent

# Create BlockNote blocks
blocks = [
    Block(
        id="1",
        type="heading",
        props={"level": 1},
        content=[InlineContent(type="text", text="Welcome to BlockNote-py!")]
    ),
    Block(
        id="2", 
        type="paragraph",
        content=[
            InlineContent(type="text", text="Convert your "),
            InlineContent(type="text", text="BlockNote", styles={"bold": True}),
            InlineContent(type="text", text=" content to multiple formats!")
        ]
    )
]

# Convert to different formats
html_output = blocks_to_html(blocks)
markdown_output = blocks_to_markdown(blocks)
pdf_bytes = blocks_to_pdf(blocks)  # Requires PDF support

print("HTML:", html_output)
print("Markdown:", markdown_output)
```

## ๐Ÿ“š Documentation

**Complete documentation:** https://rohansharmasitoula.github.io/blocknote-py/

### Quick Navigation

| Section | Description |
|---------|-------------|
| [๐Ÿš€ Quick Start](https://rohansharmasitoula.github.io/blocknote-py/getting-started/quick-start/) | Get up and running in minutes |
| [๐Ÿ”ง API Reference](https://rohansharmasitoula.github.io/blocknote-py/api/schema/) | Complete API documentation |
| [๐Ÿ”„ Converters](https://rohansharmasitoula.github.io/blocknote-py/converters/overview/) | Detailed converter documentation |
| [๐Ÿ’ก Examples](https://rohansharmasitoula.github.io/blocknote-py/examples/basic/) | Real-world usage examples |
| [๐Ÿค Contributing](https://rohansharmasitoula.github.io/blocknote-py/contributing/) | How to contribute |

## โ“ Frequently Asked Questions

**What is BlockNote-py?**  
BlockNote-py is the official BlockNote Python library that mirrors the data
model used by [BlockNote.js](https://www.blocknotejs.org/). It lets Python
developers convert BlockNote content to HTML, Markdown, PDF, and JSON without
needing Node.js on the server.

**How do I install the BlockNote Python package with PDF support?**  
Install the PyPI package with the optional PDF extra: `pip install
'blocknote-py[pdf]'`. This pulls in WeasyPrint so you can generate print-ready
PDF documents from BlockNote blocks.

**Can I use BlockNote-py on the backend of a Django or FastAPI project?**  
Yes. BlockNote-py is framework-agnostic and works in any Python backend. The
package is typed with Pydantic models, making it easy to validate incoming
BlockNote payloads in Django REST Framework, FastAPI, Flask, or any custom API.

**Does BlockNote-py stay in sync with BlockNote.js?**  
The converter and schema modules track the BlockNote.js block schema. Whenever
BlockNote introduces new block types or inline styles, BlockNote-py updates aim
to follow quickly so Python projects stay compatible.

## ๐Ÿค Contributing

Contributions are welcome! Please see our [Contributing Guide](https://rohansharmasitoula.github.io/blocknote-py/contributing/) for details.

## ๐Ÿ“„ License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## โ˜• Support the Project

If you find BlockNote-py useful, consider supporting its development:

[![Buy Me A Coffee](https://img.shields.io/badge/Buy%20Me%20A%20Coffee-support%20development-orange?style=for-the-badge&logo=buy-me-a-coffee)](https://buymeacoffee.com/sitoularohansharma)

Your support helps maintain and improve BlockNote-py for the entire Python community! ๐Ÿ™

## ๐Ÿ™ Acknowledgments

- [BlockNote.js](https://www.blocknotejs.org/) - The amazing block-based editor
- [Pydantic](https://pydantic-docs.helpmanual.io/) - For robust data validation

---

**[โญ Star this repo](https://github.com/rohansharmasitoula/blocknote-py)** if you find it useful!

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "blocknote-py",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "Rohan Sharma Sitoula <rohansharmasitoula@gmail.com>",
    "keywords": "api, block-note, blocknote, blocknote-py, blocknote-python, blocknotejs, blog, cms, content-api, content-conversion, content-management, django, document-processing, documentation, editor-backend, fastapi, flask, headless-cms, html, json, markdown, markup-converter, pdf, pydantic, python-backend, rest-api, rich-text, server-side-rendering, structured-content, text-editor, web-development, wysiwyg",
    "author": null,
    "author_email": "Rohan Sharma Sitoula <rohansharmasitoula@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/ed/40/c6fb32517bd3f7fd3cb095e9fb58c97249926240908424f3186b30dc8afd/blocknote_py-0.3.1.tar.gz",
    "platform": null,
    "description": "# BlockNote-py \ud83d\ude80 - BlockNote Python Library\n\n[![PyPI version](https://badge.fury.io/py/blocknote-py.svg)](https://pypi.org/project/blocknote-py/)\n[![Python Support](https://img.shields.io/pypi/pyversions/blocknote-py.svg)](https://pypi.org/project/blocknote-py/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Documentation](https://img.shields.io/badge/docs-available-brightgreen.svg)](https://rohansharmasitoula.github.io/blocknote-py/)\n[![CI](https://github.com/rohansharmasitoula/blocknote-py/workflows/CI/badge.svg)](https://github.com/rohansharmasitoula/blocknote-py/actions)\n[![Downloads](https://pepy.tech/badge/blocknote-py)](https://pepy.tech/project/blocknote-py)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/blocknote-py)](https://pypi.org/project/blocknote-py/)\n[![GitHub stars](https://img.shields.io/github/stars/rohansharmasitoula/blocknote-py)](https://github.com/rohansharmasitoula/blocknote-py)\n\n> **\ud83c\udfaf BlockNote Python Library** - Convert [BlockNote.js](https://www.blocknotejs.org/) blocks to HTML, Markdown, PDF & JSON with type-safe Pydantic models. Perfect for Django, FastAPI, Flask backends and headless CMS applications. Server-side BlockNote content processing made simple.\n\n## \ud83e\udd14 Why BlockNote-py?\n\n**BlockNote-py** is the missing piece for Python developers who want to work with [BlockNote.js](https://www.blocknotejs.org/) content on the server-side. Whether you're building a Django blog, FastAPI content API, or Flask CMS, BlockNote-py provides seamless integration with Python backends.\n\n### \ud83c\udfaf Perfect For:\n- **Django Developers**: Process BlockNote content in Django models and views\n- **FastAPI APIs**: Build content APIs with automatic validation and serialization  \n- **Flask Applications**: Add rich text processing to Flask apps\n- **Headless CMS**: Convert editor content to multiple formats\n- **Content Migration**: Batch process and convert existing content\n- **PDF Reports**: Generate professional documents from editor content\n\n## \u2728 Features\n\n- \ud83d\udd04 **Multiple Format Support**: HTML, Markdown, PDF, and Dictionary conversion\n- \ud83c\udf10 **HTML Conversion**: Full bidirectional HTML support with styling preservation\n- \ud83d\udcdd **Markdown Support**: Convert to/from Markdown with formatting\n- \ud83d\udcc4 **PDF Generation**: Convert BlockNote blocks to professional PDF documents with WeasyPrint\n- \ud83d\udee1\ufe0f **Type Safety**: Built with Pydantic v2 for robust data validation and IDE support\n- \ud83c\udfa8 **Rich Formatting**: Bold, italic, colors, lists, quotes, headings, and more\n- \ud83e\uddea **Well Tested**: Comprehensive test suite with 88+ tests and 95% coverage\n- \ud83d\udcda **Great Documentation**: Detailed docs with real-world examples\n- \u26a1 **Fast & Lightweight**: Minimal dependencies, maximum performance\n- \ud83d\udd27 **Framework Agnostic**: Works with any Python web framework\n\n## \ud83d\udce6 Installation\n\n### Basic Installation\n```bash\npip install blocknote-py\n```\n\n### With PDF Support\n```bash\npip install 'blocknote-py[pdf]'\n```\n\n### Full Installation (all features)\n```bash\npip install 'blocknote-py[all]'\n```\n\n## \ud83d\ude80 Quick Start\n\n```python\nfrom blocknote.converter import blocks_to_html, blocks_to_markdown, blocks_to_pdf\nfrom blocknote.schema import Block, InlineContent\n\n# Create BlockNote blocks\nblocks = [\n    Block(\n        id=\"1\",\n        type=\"heading\",\n        props={\"level\": 1},\n        content=[InlineContent(type=\"text\", text=\"Welcome to BlockNote-py!\")]\n    ),\n    Block(\n        id=\"2\", \n        type=\"paragraph\",\n        content=[\n            InlineContent(type=\"text\", text=\"Convert your \"),\n            InlineContent(type=\"text\", text=\"BlockNote\", styles={\"bold\": True}),\n            InlineContent(type=\"text\", text=\" content to multiple formats!\")\n        ]\n    )\n]\n\n# Convert to different formats\nhtml_output = blocks_to_html(blocks)\nmarkdown_output = blocks_to_markdown(blocks)\npdf_bytes = blocks_to_pdf(blocks)  # Requires PDF support\n\nprint(\"HTML:\", html_output)\nprint(\"Markdown:\", markdown_output)\n```\n\n## \ud83d\udcda Documentation\n\n**Complete documentation:** https://rohansharmasitoula.github.io/blocknote-py/\n\n### Quick Navigation\n\n| Section | Description |\n|---------|-------------|\n| [\ud83d\ude80 Quick Start](https://rohansharmasitoula.github.io/blocknote-py/getting-started/quick-start/) | Get up and running in minutes |\n| [\ud83d\udd27 API Reference](https://rohansharmasitoula.github.io/blocknote-py/api/schema/) | Complete API documentation |\n| [\ud83d\udd04 Converters](https://rohansharmasitoula.github.io/blocknote-py/converters/overview/) | Detailed converter documentation |\n| [\ud83d\udca1 Examples](https://rohansharmasitoula.github.io/blocknote-py/examples/basic/) | Real-world usage examples |\n| [\ud83e\udd1d Contributing](https://rohansharmasitoula.github.io/blocknote-py/contributing/) | How to contribute |\n\n## \u2753 Frequently Asked Questions\n\n**What is BlockNote-py?**  \nBlockNote-py is the official BlockNote Python library that mirrors the data\nmodel used by [BlockNote.js](https://www.blocknotejs.org/). It lets Python\ndevelopers convert BlockNote content to HTML, Markdown, PDF, and JSON without\nneeding Node.js on the server.\n\n**How do I install the BlockNote Python package with PDF support?**  \nInstall the PyPI package with the optional PDF extra: `pip install\n'blocknote-py[pdf]'`. This pulls in WeasyPrint so you can generate print-ready\nPDF documents from BlockNote blocks.\n\n**Can I use BlockNote-py on the backend of a Django or FastAPI project?**  \nYes. BlockNote-py is framework-agnostic and works in any Python backend. The\npackage is typed with Pydantic models, making it easy to validate incoming\nBlockNote payloads in Django REST Framework, FastAPI, Flask, or any custom API.\n\n**Does BlockNote-py stay in sync with BlockNote.js?**  \nThe converter and schema modules track the BlockNote.js block schema. Whenever\nBlockNote introduces new block types or inline styles, BlockNote-py updates aim\nto follow quickly so Python projects stay compatible.\n\n## \ud83e\udd1d Contributing\n\nContributions are welcome! Please see our [Contributing Guide](https://rohansharmasitoula.github.io/blocknote-py/contributing/) for details.\n\n## \ud83d\udcc4 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## \u2615 Support the Project\n\nIf you find BlockNote-py useful, consider supporting its development:\n\n[![Buy Me A Coffee](https://img.shields.io/badge/Buy%20Me%20A%20Coffee-support%20development-orange?style=for-the-badge&logo=buy-me-a-coffee)](https://buymeacoffee.com/sitoularohansharma)\n\nYour support helps maintain and improve BlockNote-py for the entire Python community! \ud83d\ude4f\n\n## \ud83d\ude4f Acknowledgments\n\n- [BlockNote.js](https://www.blocknotejs.org/) - The amazing block-based editor\n- [Pydantic](https://pydantic-docs.helpmanual.io/) - For robust data validation\n\n---\n\n**[\u2b50 Star this repo](https://github.com/rohansharmasitoula/blocknote-py)** if you find it useful!\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2025 Rohan Sharma  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "\ud83d\ude80 BlockNote Python library - Convert BlockNote.js blocks to HTML, Markdown, PDF & JSON. Type-safe Pydantic models for Django, FastAPI, Flask backends. Rich text editor content processing made easy.",
    "version": "0.3.1",
    "project_urls": {
        "API Reference": "https://rohansharmasitoula.github.io/blocknote-py/api/",
        "Bug Tracker": "https://github.com/rohansharmasitoula/blocknote-py/issues",
        "Changelog": "https://rohansharmasitoula.github.io/blocknote-py/changelog/",
        "Documentation": "https://rohansharmasitoula.github.io/blocknote-py/",
        "Download": "https://pypi.org/project/blocknote-py/#files",
        "Examples": "https://rohansharmasitoula.github.io/blocknote-py/examples/",
        "Funding": "https://buymeacoffee.com/sitoularohansharma",
        "Homepage": "https://rohansharmasitoula.github.io/blocknote-py/",
        "Issues": "https://github.com/rohansharmasitoula/blocknote-py/issues",
        "PyPI": "https://pypi.org/project/blocknote-py/",
        "Repository": "https://github.com/rohansharmasitoula/blocknote-py",
        "Source Code": "https://github.com/rohansharmasitoula/blocknote-py"
    },
    "split_keywords": [
        "api",
        " block-note",
        " blocknote",
        " blocknote-py",
        " blocknote-python",
        " blocknotejs",
        " blog",
        " cms",
        " content-api",
        " content-conversion",
        " content-management",
        " django",
        " document-processing",
        " documentation",
        " editor-backend",
        " fastapi",
        " flask",
        " headless-cms",
        " html",
        " json",
        " markdown",
        " markup-converter",
        " pdf",
        " pydantic",
        " python-backend",
        " rest-api",
        " rich-text",
        " server-side-rendering",
        " structured-content",
        " text-editor",
        " web-development",
        " wysiwyg"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "2639a274c395a3ec618ffaacaabdbdc4f3912eba06210e2647e74214965c6cc5",
                "md5": "d3dcb721e515960426aca1b8a3fee080",
                "sha256": "6dd7df7ce1581d88590c173d9733ca5eb8ad7427b443dbf4e8f801cb7fd91786"
            },
            "downloads": -1,
            "filename": "blocknote_py-0.3.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d3dcb721e515960426aca1b8a3fee080",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 53230,
            "upload_time": "2025-10-28T20:53:21",
            "upload_time_iso_8601": "2025-10-28T20:53:21.426173Z",
            "url": "https://files.pythonhosted.org/packages/26/39/a274c395a3ec618ffaacaabdbdc4f3912eba06210e2647e74214965c6cc5/blocknote_py-0.3.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "ed40c6fb32517bd3f7fd3cb095e9fb58c97249926240908424f3186b30dc8afd",
                "md5": "040611f05e5a71b6a53a710b11d39150",
                "sha256": "cc3ad3f82ea277accf8348ce7630db09826d4ac3034431c6b49d5a9d7c419cd9"
            },
            "downloads": -1,
            "filename": "blocknote_py-0.3.1.tar.gz",
            "has_sig": false,
            "md5_digest": "040611f05e5a71b6a53a710b11d39150",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 190004,
            "upload_time": "2025-10-28T20:53:22",
            "upload_time_iso_8601": "2025-10-28T20:53:22.951243Z",
            "url": "https://files.pythonhosted.org/packages/ed/40/c6fb32517bd3f7fd3cb095e9fb58c97249926240908424f3186b30dc8afd/blocknote_py-0.3.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-28 20:53:22",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "rohansharmasitoula",
    "github_project": "blocknote-py",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "blocknote-py"
}
        
Elapsed time: 2.56092s