Skip to main content
Pre-release

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

omni-mdx

Build Coverage Downloads Version License

The high-performance MDX engine for Python, powered by a native Rust core.

pip install omni-mdx

Contents

What is this?

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).

When should I use this?

  • Extreme Performance: You need to parse large amounts of MDX content without blocking the Python GIL, thanks to the native Rust core.
  • Data Mining & AI: You want to extract structured data (formulas, metadata, components) from MDX for LLM ingestion or indexing.
  • Native Desktop Apps: You are building a PyQt5 or PySide application and need to render rich Markdown and Math equations without the overhead of a heavy WebEngine/Chromium component.
  • Scientific Publishing: You need robust, built-in support for GFM Tables and KaTeX/LaTeX math.

Install

The package is distributed as a Fat Wheel, meaning the Rust binary is bundled directly. No Rust toolchain is required for installation.

pip install omni-mdx

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

Use

1. Parsing to AST

Transform 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 returns an MdxAstRoot object
ast = omni_mdx.parse(mdx_content)

# Nodes are accessible via ast.nodes
for node in ast.nodes:
    if node.node_type == "BlockMath":
        print(f"Formula found: {node.attributes.get('data-math')}")

2. Web Rendering (HTML)

Generate clean, standards-compliant HTML.

from omni_mdx import render_html, parse

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

# Register custom rendering logic for JSX components
def render_speaker(node, ctx):
    name = node.attributes.get("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.

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

# 1. Parse and render
nodes = omni_mdx.parse("# Hello Native!").nodes
renderer = QtRenderer()
content_widget = renderer.render(nodes)

# 2. Add to your UI
scroll = QScrollArea()
scroll.setWidget(content_widget)
scroll.setWidgetResizable(True)

API

omni_mdx.parse(source: str) -> MdxAstRoot

Parses the MDX source string into an AST root.

  • Returns: An MdxAstRoot containing a list of MdxNode objects.

MdxNode Properties

  • node_type: The type of the node (e.g., "h1", "text", "BlockMath").
  • content: The raw content of the node.
  • attributes: A dictionary of JSX props or math metadata.
  • children: A list of child MdxNode objects.
  • is_component: Boolean indicating if the node is a JSX component.

Architecture

Omni-MDX utilizes a "Bridge" architecture. The heavy parsing is performed in Rust, producing a high-performance tree. This tree is then wrapped in a Python layer that provides a familiar, typed API for manipulation and rendering.

Compatibility

  • Python: 3.11+.
  • Operating Systems: Linux (x86_64, aarch64), macOS (Intel, Apple Silicon), Windows (x86_64).
  • GUI Frameworks: Optimized for PyQt5 but compatible with any logic that can ingest the AST.

Security

The Rust core provides a safety layer against common regex-based DoS attacks found in many pure-Python parsers. For HTML rendering, ensure your custom components properly sanitize any raw user input if necessary.

Contribute

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

  • Python Layer Coverage: 88.10%.
  • Core Rust Coverage: 81.29%.

See the Contribution Guide to get started with local development and maturin.

License

MIT © TOAQ-oss

Metadata

Release files for omni-mdx 1.1.1.dev1776371676

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.1.dev1776371676
File Interpreter ABI Platform Actions
omni_mdx-1.1.1.dev1776371676-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for omni_mdx-1.1.1.dev1776371676-cp313-cp313-win_amd64.whl
omni_mdx-1.1.1.dev1776371676-cp313-cp313-manylinux_2_34_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.34+ x86-64 Details for omni_mdx-1.1.1.dev1776371676-cp313-cp313-manylinux_2_34_x86_64.whl
omni_mdx-1.1.1.dev1776371676-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details for omni_mdx-1.1.1.dev1776371676-cp313-cp313-macosx_11_0_arm64.whl

Total release size: 2.2 MB

Release files / omni_mdx-1.1.1.dev1776371676-cp313-cp313-win_amd64.whl

Download URL omni_mdx-1.1.1.dev1776371676-cp313-cp313-win_amd64.whl
Size 641.4 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
ec49b3c0660901c60b47755c63cb693ac4ebc17699b38f3330801ea8b4bfc412
BLAKE2b-256 checksum
How to use checksums
4b95b3bcc398f2843a8ca4496ce7876ae0c2f92cf2c0827a7079b3620f2e78f2
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 16, 2026.

Transparency log

Release files / omni_mdx-1.1.1.dev1776371676-cp313-cp313-manylinux_2_34_x86_64.whl

Download URL omni_mdx-1.1.1.dev1776371676-cp313-cp313-manylinux_2_34_x86_64.whl
Size 826.4 kB
Tags CPython 3.13 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
f6c63083d61c5c6b914d313975a61d51db6e382bb414f1492cdbe5627e9e8d43
BLAKE2b-256 checksum
How to use checksums
4899a356c172ccf76cc4ab145fd948756fd5a626219db8febac38b788dc45d2a
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 16, 2026.

Transparency log

Release files / omni_mdx-1.1.1.dev1776371676-cp313-cp313-macosx_11_0_arm64.whl

Download URL omni_mdx-1.1.1.dev1776371676-cp313-cp313-macosx_11_0_arm64.whl
Size 720.5 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
61b749577d576533d89610790ed81c6865e921d861dfc484f68d498c1aa5d23b
BLAKE2b-256 checksum
How to use checksums
8990372f269b0cb4b168e2f50dca4ca816d9b062c97e2c1f7fe18a18b9318d06
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 16, 2026.

Transparency log

Security for omni-mdx 1.1.1.dev1776371676

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.

Full provenance

All 3 files in this release have been uploaded with provenance metadata.

Select from 3 files

Attestation for omni_mdx-1.1.1.dev1776371676-cp313-cp313-win_amd64.whl

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 16, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

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