Skip to main content

markdown-it-py-rust (Rust mirror of executablebooks/markdown-it-py)

Stage-1 Rust mirror of executablebooks/markdown-it-py (MIT). Behavior-identical port of markdown_it/*.py exposed as the markdown_it._markdown_it extension module via PyO3, with thin markdown_it/*.py re-export shims preserving the original public API (MarkdownIt, Token, presets, plugins, CLI, ...).

Layout (publishable)

One implementation, two distributions:

  • markdown-it-core/ — reusable pure-Rust core crate markdown-it-rust-core (crates.io). No Python dependency: rlib, cargo test clean. Rust consumers depend on this crate directly.
  • src/ — thin PyO3 binding crate markdown-it-py-rust calling that same core. Ships on PyPI as distribution markdown-it-py-rust; the import name is unchanged (import markdown_it), so users swap the install with zero code changes: pip install markdown-it-py-rust instead of pip install markdown-it-py.
  • markdown_it/ — Python shims (one per original module; tree.py, cli/, presets/, and utils.read_fixture_file stay verbatim Python).
  • release.toml — release configuration (names, version, platforms, Python versions, publishing repo + workflow identity, license, upstream attribution). Read by rustsmith release-prep; see docs/RELEASE.md.

No redesign: same token stream, same plugin rule protocol, same HTML.

Porting boundary

Everything is ported to Rust except three host-callback seams (matching the original behavior exactly through the Host trait):

  • mdurl (normalizeLink/normalizeLinkText) and linkify-it-py (md.linkify) stay Python packages, called through the GIL;
  • plugin rule callables (Ruler.before/after/at/push, render-rule overrides, highlight) run as Python callbacks over the live core state;
  • Token.meta supports JSON-shaped values (None/bool/int/float/str); arbitrary objects raise TypeError on assignment.

Install

pip install markdown-it-py-rust
from markdown_it import MarkdownIt
MarkdownIt().render("# hi")

Measured performance

No accepted optimizations yet (mirror baseline); re-run release-prep after run --stage optimize merges winners. Artifact hashes are intentionally absent here; see release-manifest.json.

Metadata

Release files for markdown-it-py-rust 4.2.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 markdown-it-py-rust 4.2.0
File Size Uploaded
markdown_it_py_rust-4.2.0.tar.gz 116.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for markdown-it-py-rust 4.2.0
File Interpreter ABI Platform
markdown_it_py_rust-4.2.0-cp312-cp312-manylinux_2_34_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.34+ x86-64 Details

Total release size: 1.7 MB

Release files / markdown_it_py_rust-4.2.0.tar.gz

Download URL markdown_it_py_rust-4.2.0.tar.gz
Size 116.1 kB
Tags Source
SHA-256 checksum
How to use checksums
03c85346ecd993d90144599f4c288b240f3edd786e3ff1f3396083be73bed2ea
BLAKE2b-256 checksum
How to use checksums
ae15784079b44539565322869fbfe3044212f198ec9deec074426b1ffad54f61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.2

Release files / markdown_it_py_rust-4.2.0-cp312-cp312-manylinux_2_34_x86_64.whl

Download URL markdown_it_py_rust-4.2.0-cp312-cp312-manylinux_2_34_x86_64.whl
Size 1.6 MB
Tags CPython 3.12 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
91c4d88cdc256392c5572b0b7e51706b342b9a836e3f13e990ea55bd86cdfb8a
BLAKE2b-256 checksum
How to use checksums
2cb305cc1151d4773f81f4a2e68c0a237da0fbedaacc7baad7d43d8b23e01f15
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.2

Release history Release notifications | RSS feed

This release

4.2.0 This release

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