Example: Basic Parsing & Traversal
Last Updated March 27, 2026
The foundation of the Omni-MDX Python engine is its ability to parse Markdown and JSX at lightning speed while keeping the memory footprint near zero. This example demonstrates how to load a document and iterate through its native AST nodes.
ℹ️ Information
Full Source Code: Clone and test this environment directly from omni-mdx-sandbox/python/basic-parsing.
Extracting Node Information
Imagine you want to parse a simple document and isolate specific JSX alerts to check their severity.
1. The Source MDX File
You have a standard MDX string containing custom components:
mdx
2. The Python Extraction Script
On the Python side, you use the omni_mdx.parse() function. Because of the Zero-Copy architecture, the attributes are instantly available as a native Python dictionary.
python
By leveraging the AST, you bypass the need for fragile regular expressions, accessing your document’s semantic structure safely and efficiently.