Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

omni-mdx

A blazingly fast, headless MDX engine for Python, powered by a native Rust core.

omni-mdx provides a high-performance bridge between the pulldown-cmark Rust parser and native Python applications. It parses MDX (Markdown + JSX) into a deeply manipulable Abstract Syntax Tree (AST) and offers zero-dependency native rendering solutions for both the Web (HTML/KaTeX) and Desktop (PyQt5/Matplotlib).

⚡ Key Features

  • 🚀 Blazing Fast: Parsing is handled by a pre-compiled Rust binary. Experience performance up to 10x faster than pure Python parsers.
  • 🧠 Headless AST: Manipulate Markdown and JSX tags as pure Python objects (AstNode). Perfect for data extraction and content analysis.
  • 🖼️ Zero-HTML Desktop Rendering: Render rich text, complex layouts, and math equations natively in PyQt5 without the overhead of heavy WebEngine/Chromium components.
  • 📐 Universal Math Support:
    • Web: Generates data-math attributes compatible with KaTeX.
    • Desktop: Generates high-quality native images via Matplotlib with automatic Unicode fallback.
  • 📦 Fat Wheel Distribution: The Rust binary is bundled directly into the Python package. No Rust toolchain required for end-users.

📦 Installation

pip install omni-mdx

# Optional: Required for high-quality Desktop math rendering
pip install matplotlib PyQt5

🛠️ Quick Start

1. Parsing MDX to AST

The core strength of omni-mdx is transforming raw text into a structured, searchable tree.

import omni_mdx

mdx_content = r"""
# Physics 101
The kinetic energy is defined as:
$$\zeta(s) = \sum_{n=1}^\infty \frac{1}{n^s}$$

<Note type="warning">Check your units!</Note>
"""

# Parse the text into a list of AstNode objects
nodes = omni_mdx.parse(mdx_content)

# Search the AST for specific elements
math_blocks = [n for n in nodes if n.node_type == "BlockMath"]
if math_blocks:
    print(f"Formula found: {math_blocks[0].content}") 
    # Output: \zeta(s) = \sum_{n=1}^\infty \frac{1}{n^s}

2. Web Rendering (HTML)

Generate clean, standards-compliant HTML for FastAPI, Flask, or static site generators.

from omni_mdx import render_html, parse

nodes = parse("<Speaker name='Leon'>Welcome to the show.</Speaker>")

# Register custom rendering logic for JSX components
def render_speaker(node, ctx):
    name = node.attr_text("name")
    return f'<div class="speaker-tag"><b>{name}:</b> {node.text_content()}</div>'

html_output = render_html(nodes, components={"Speaker": render_speaker})

3. Native Desktop Rendering (PyQt5)

Render MDX content directly into native Qt Widgets. No browser engine needed.

from PyQt5.QtWidgets import QScrollArea
from omni_mdx.qt_renderer import QtRenderer

# 1. Parse content
nodes = omni_mdx.parse("# Hello Native!")

# 2. Render to Widget
renderer = QtRenderer()
content_widget = renderer.render(nodes)

# 3. Add to your UI (using a ScrollArea is recommended)
scroll = QScrollArea()
scroll.setWidget(content_widget)
scroll.setWidgetResizable(True)

🧠 Advanced AST Manipulation

Because omni-mdx generates a typed AstNode tree, it is an ideal tool for large-scale text analysis, TTS (Text-To-Speech) dataset generation, or automated content moderation.

from omni_mdx import parse

script = """
<Speaker name="Dr. Aris" voiceId="v2">
We must look closer at the probability wave.
</Speaker>

<Speaker name="Leon" voiceId="v1">
Are you certain?
</Speaker>
"""

nodes = parse(script)

# Extract dialogue for dataset generation
dataset = []
for node in nodes:
    if node.node_type == "Speaker":
        dataset.append({
            "character": node.attr_text("name"),
            "voice_profile": node.attr_text("voiceId"),
            "text": node.text_content().strip()
        })

print(dataset[0]["text"]) # "We must look closer at the probability wave."

🏗️ Architecture

Module Description
core_interface Bridge to the native Rust _core binary.
renderer High-performance HTML generator.
qt_renderer Native PyQt5 layout engine (uses a custom FlowLayout).
math_render LaTeX logic: Unicode mapping & Matplotlib integration.

🤝 Contributing

This package is part of the TOAQ open-source ecosystem.

Release files for omni-mdx 1.1.0.dev1776246848

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for omni-mdx 1.1.0.dev1776246848
File Interpreter ABI Platform
omni_mdx-1.1.0.dev1776246848-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
omni_mdx-1.1.0.dev1776246848-cp313-cp313-manylinux_2_34_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.34+ x86-64 Details
omni_mdx-1.1.0.dev1776246848-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details

Total release size:2.2 MB

Release files / omni_mdx-1.1.0.dev1776246848-cp313-cp313-win_amd64.whl

Download URL omni_mdx-1.1.0.dev1776246848-cp313-cp313-win_amd64.whl
Size 640.1 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
a7dee3b8becfddab0221d1d575394fa295a29c3b968313f4a798ff52f5f9dc2d
BLAKE2b-256 checksum
How to use checksums
57b99cc592c6f23060a99ba456cac8ad002e85dc6b14a8c45b17bd5256e7e84d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 15, 2026.

Transparency log

Release files / omni_mdx-1.1.0.dev1776246848-cp313-cp313-manylinux_2_34_x86_64.whl

Download URL omni_mdx-1.1.0.dev1776246848-cp313-cp313-manylinux_2_34_x86_64.whl
Size 825.3 kB
Tags CPython 3.13 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
1c2822aaefc6207060736abf13aa70c1aaa7b3cdec893730fa94e1ea1dd3e068
BLAKE2b-256 checksum
How to use checksums
df1e2586d2c1d4610a011f7e1460d5cb7bfb9cfe509b8f8c49309eb38d62f6be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 15, 2026.

Transparency log

Release files / omni_mdx-1.1.0.dev1776246848-cp313-cp313-macosx_11_0_arm64.whl

Download URL omni_mdx-1.1.0.dev1776246848-cp313-cp313-macosx_11_0_arm64.whl
Size 719.3 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
54f5aec156b485d6bbedb8eec10149aabe17306d1a0cdb1f5f1611d29d0545dd
BLAKE2b-256 checksum
How to use checksums
637f9d9654662ec97ace6997ba8b2c7e46d8ac8bdaa6922667f181a44b498a3d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 15, 2026.

Transparency log

Release history Release notifications | RSS feed

1.1.1

3 release files

1.1.0

3 release files

This release

1.0.0

3 release files

0.1.17

3 release files

0.1.16

3 release files

0.1.15

3 release files

0.1.14

3 release files

0.1.13

3 release files

0.1.11

3 release files

0.1.9

3 release files

0.1.8

3 release files

0.1.6

3 release files

0.1.5

3 release files

0.1.4

3 release files

0.1.3

3 release files

0.1.2

3 release files

0.1.1

3 release files

0.1.0

3 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