Skip to main content

Python bindings for illusion Markdown (MDI), backed by the Rust core.

Project description

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, or Aozora 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.

License

MIT

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

illusion_markdown-2.0.2.tar.gz (42.3 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.2-cp310-abi3-win_amd64.whl (675.1 kB view details)

Uploaded CPython 3.10+Windows x86-64

illusion_markdown-2.0.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (899.1 kB view details)

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

illusion_markdown-2.0.2-cp310-abi3-macosx_11_0_arm64.whl (807.6 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

illusion_markdown-2.0.2-cp310-abi3-macosx_10_12_x86_64.whl (818.3 kB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: illusion_markdown-2.0.2.tar.gz
  • Upload date:
  • Size: 42.3 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.2.tar.gz
Algorithm Hash digest
SHA256 8f06fdf71018a77bbfaa8952fbeb2991090b201b10b55c7de2e777b23dda3da8
MD5 85f7d3cc538874f588631384a4af7e3b
BLAKE2b-256 77df3a44b4e38df7231023da3f7719223d1f11c0611eeba4f5f69d056c749ea9

See more details on using hashes here.

Provenance

The following attestation bundles were made for illusion_markdown-2.0.2.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.2-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for illusion_markdown-2.0.2-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 f8dc1e558ab40318e4d5b91d08ecfa1818e09c1fa4fe193522268b3baa34a38d
MD5 f07fb3d68e8c2b97cc055d8b54b29d12
BLAKE2b-256 1325a96092589310dc5cd93506ae593a5e589a5394e619785a09110e08e71774

See more details on using hashes here.

Provenance

The following attestation bundles were made for illusion_markdown-2.0.2-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.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for illusion_markdown-2.0.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9a6bbed07b209a2b0fdd21367c154564e43a3778321ec0f4c10f0d90621e0373
MD5 91c5fe12d73dd0ad7a829882b56df97c
BLAKE2b-256 da1596e635dac59daffe60bf28aa073595fd8c49517791e3b78bdc4b8ae3e05f

See more details on using hashes here.

Provenance

The following attestation bundles were made for illusion_markdown-2.0.2-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.2-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for illusion_markdown-2.0.2-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 70f48cf1b607be29512fb1947558cbe84c625b4776a401f977226b0b386db6ed
MD5 37db1729c241e702bd1bab378cccda5d
BLAKE2b-256 332a3f73973660ae3f4a2705084728f976bbbe5306c3440a8b1b4b6977dfccd1

See more details on using hashes here.

Provenance

The following attestation bundles were made for illusion_markdown-2.0.2-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.2-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for illusion_markdown-2.0.2-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 9d09239b51c6a96f3028800d8cb0c34f3dcda53d9bb1a94007d405fea3b889e5
MD5 075dc1f408a99a19d86a2943d2a70005
BLAKE2b-256 ec45cc30a3d146c24cb99d1b7060f7105c3e1adabd0e43e6ab66ca0a3acfbcfa

See more details on using hashes here.

Provenance

The following attestation bundles were made for illusion_markdown-2.0.2-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.

Supported by

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