Skip to main content

illusion-markdown

PyPI Python License

Official Python bindings for illusion Markdown (MDI). illusion-markdown parses complete MDI documents, returns the versioned document IR, and renders HTML, text, EPUB, and DOCX through the canonical Rust implementation. Python is an ergonomic API layer only: it does not carry a second Markdown parser or renderer.

Read the Python API documentation →

Install

pip install illusion-markdown

The PyPI distribution is illusion-markdown; the Python import namespace is mdi. Python 3.10 or newer is required.

Quick start

import mdi

source = """---
title: 東京の夜
lang: ja
---

# {東京|とうきょう}の夜

第^12^話
"""

result = mdi.parse(source)
print(result["document"]["children"][0]["type"])

html = mdi.render_html(source)
open("book.html", "w", encoding="utf-8").write(html)

parse() returns a JSON-compatible dictionary with the MDI syntax version, IR version, parser capabilities, document tree, and recoverable diagnostics. Every source-backed span is a half-open UTF-8 byte range.

API

Function Result
mdi.parse(source) Versioned document IR and diagnostics.
mdi.serialize_mdi(source) Canonical MDI/Markdown source.
mdi.render_html(source) A standalone HTML document.
mdi.render_text(source) Deterministic plain text.
mdi.render_text_format(source, format) TXT, ruby, Narou, Kakuyomu, Aozora, or note text.
mdi.render_epub(source) EPUB 3 archive bytes.
mdi.render_docx(source) DOCX archive bytes.
epub_bytes = mdi.render_epub("# Chapter\n\nText")
with open("book.epub", "wb") as output:
    output.write(epub_bytes)

See the official Python documentation for API details, the complete MDI syntax, output formats, and architecture.

Platform support

Prebuilt wheels are published for macOS (Intel and Apple Silicon), Linux x64, and Windows x64. A source distribution is also available for other platforms with a supported Rust toolchain.

Development

The binding is tested against a locally built native extension. From this directory, use Python 3.10 or newer:

python -m pip install -e ".[test]"
python -m pytest --cov=mdi --cov-branch

The test suite covers the public Python contract, including the versioned IR, UTF-8 byte spans, diagnostics, all text exports, archive structure, type boundaries, and the stable API surface.

License

MIT

Download files

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

Source Distribution

illusion_markdown-2.0.4.tar.gz (81.4 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

illusion_markdown-2.0.4-cp310-abi3-win_amd64.whl (772.2 kB view details)

Uploaded CPython 3.10+Windows x86-64

illusion_markdown-2.0.4-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

illusion_markdown-2.0.4-cp310-abi3-macosx_11_0_arm64.whl (900.9 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

illusion_markdown-2.0.4-cp310-abi3-macosx_10_12_x86_64.whl (914.2 kB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

File details

Details for the file illusion_markdown-2.0.4.tar.gz.

File metadata

  • Download URL: illusion_markdown-2.0.4.tar.gz
  • Upload date:
  • Size: 81.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for illusion_markdown-2.0.4.tar.gz
Algorithm Hash digest
SHA256 e97685d8ed5b63abd6b8b7ecaaf502e972ae44173312e09de6a73f7b39e8b3a8
MD5 ade368ff4e08e4b94bcfb49400961712
BLAKE2b-256 bb7af4ee9f65a656258e1463292e823da04a96306422a2c7a486ad022eb557c4

See more details on using hashes here.

Provenance

The following attestation bundles were made for illusion_markdown-2.0.4.tar.gz:

Publisher: release-pypi.yml on illusions-lab/MDI

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file illusion_markdown-2.0.4-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for illusion_markdown-2.0.4-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 452c1618afc78710ba808203a1a2a15677914dbf35b8008f61153d869cc57a10
MD5 a011ee45a6a2b9160b7e6ee445cdfe5d
BLAKE2b-256 ecb6a61a3712dc20b3bc9a65c5075d794eb6024f250f57d5f9b0d23323cada9b

See more details on using hashes here.

Provenance

The following attestation bundles were made for illusion_markdown-2.0.4-cp310-abi3-win_amd64.whl:

Publisher: release-pypi.yml on illusions-lab/MDI

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file illusion_markdown-2.0.4-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for illusion_markdown-2.0.4-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7ac6e5040813baca965220d96eca33c6f817508784fa76481a53b36e7e742453
MD5 569cd62c914fb1c88fb60283d03e81cc
BLAKE2b-256 65a2f31052cd6d8f672ad80a0bc7c43b82fe3f98a0b893614f73a5799ef1bda1

See more details on using hashes here.

Provenance

The following attestation bundles were made for illusion_markdown-2.0.4-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release-pypi.yml on illusions-lab/MDI

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file illusion_markdown-2.0.4-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for illusion_markdown-2.0.4-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 89a01ec1ff01bad396ae91a34072086616c386a19b40422903f0f4dbfb380951
MD5 eec8f545f34845bad912666ab96287fd
BLAKE2b-256 70e6660d9f662c9da8da6e95c4ae4cb77bf0406df0cc7d31133a83ddd2e62ae2

See more details on using hashes here.

Provenance

The following attestation bundles were made for illusion_markdown-2.0.4-cp310-abi3-macosx_11_0_arm64.whl:

Publisher: release-pypi.yml on illusions-lab/MDI

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file illusion_markdown-2.0.4-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for illusion_markdown-2.0.4-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 a6eb69824c959d8d47ce77aa0b82b9e6a2cd1d402a38a6e895f6a4829698f94d
MD5 4cf5ba6ad4d1633381a29ba144646d00
BLAKE2b-256 daafb4176fa676746df8bc10b7bd2bd2d02d024a3ee07ba1e5687fd774e840a3

See more details on using hashes here.

Provenance

The following attestation bundles were made for illusion_markdown-2.0.4-cp310-abi3-macosx_10_12_x86_64.whl:

Publisher: release-pypi.yml on illusions-lab/MDI

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

2.0.5

5 files

This release

2.0.4 This release

5 files

2.0.3

5 files

2.0.2

5 files

2.0.1

5 files

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