markdown-it-py

A CommonMark-compliant Markdown parser for Python, ported from the JS markdown-it

Library
PyPI
v4.2.0
1,382 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
84 /100 Excellent
Development Activity 80
Maintenance 84
Community 72
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
72 /100 Good
Architecture 80
Code Quality 78
Innovation 62
Learning Curve 68

markdown-it-py is a faithful Python port of the popular JavaScript markdown-it parser, giving Python projects a fast, spec-compliant CommonMark parser with a pluggable rule-based architecture. Rather than a monolithic regex-based converter, it tokenizes Markdown through a chain of block, inline, and core rules, then renders those tokens to HTML (or any other target) through a separate, overridable renderer.

This separation of parsing from rendering, plus a first-class plugin system, is what makes it the parser of choice underneath tools like MyST, Sphinx extensions, and Rich’s Markdown support: consumers can add syntax extensions (footnotes, tables, front matter) or walk the token/syntax tree directly instead of only getting a final HTML string.

What You Get

  • 100% CommonMark specification compliance out of the box
  • A pluggable rule chain (block, inline, core rules) instead of a monolithic parser
  • A separate, overridable renderer, so you can target HTML, a tree structure, or a custom output
  • A SyntaxTreeNode API for walking the parsed document as a tree rather than a flat token list
  • An official plugin ecosystem (mdit-py-plugins) for footnotes, front matter, tables, and more
  • A small bundled CLI for quick file-to-HTML conversion

Common Use Cases

  • Powering documentation generators (Sphinx/MyST-Parser) that need CommonMark plus custom directives
  • Rendering Markdown to HTML inside web apps and static site generators
  • Building custom Markdown dialects by adding or removing rules and plugins
  • Terminal/CLI tools (like rich) that render Markdown to formatted console output

Under The Hood

Architecture - Parsing runs through three sequential phases: parser_block.py and parser_inline.py each apply an ordered chain of rules (in rules_block/ and rules_inline/) to produce a flat token stream, parser_core.py runs post-processing core rules over that stream, and renderer.py walks the tokens to emit HTML by default; tree.py layers an optional SyntaxTreeNode view on top of the same tokens for structured traversal. Tech Stack - Modern typed Python (3.10+) with a single runtime dependency (mdurl for URL parsing), built with flit_core, and validated through tox across Python versions; ships a py.typed marker for type-checker consumers. Code Quality - The project mirrors the upstream JS markdown-it test fixtures for CommonMark conformance plus its own tests/ suite, and tracks a port.yaml file recording exact parity with the JS implementation, giving strong confidence in spec correctness. API Design - The top-level MarkdownIt().render(text) call covers the common case in one line, while the rule/plugin system (.use(plugin), .disable(rule)) exposes real extensibility for advanced consumers — a small learning curve for basic use, more depth required to customize rules.

Used by 15 apps in this directory

Rust
63%
MIT

PostgresML

AI Development · Databases

6,823

Run ML training and LLM inference natively inside PostgreSQL with GPU acceleration — no data movement required.

View details
51
Repo Health
76
Technical
64
Dependency
Built with
Rust 63%
JavaScript 11%
Updated 1 years ago
Python
55%
Other

PostHog

Ab Testing Experimentation · Analytics · Developer Tools

40,397

The all-in-one open source product platform combining analytics, session replay, feature flags, error tracking, AI observability, and a built-in data warehouse in a single self-hostable stack.

View details
92
Repo Health
80
Technical
65
Dependency
Built with
Python 55%
TypeScript 36%
Updated 6 days ago
Python
82%
AGPL 3.0

SearXNG

Search

38,786

Privacy-first metasearch engine that aggregates results from 250+ search services — no tracking, no profiling, full control when self-hosted.

View details
80
Repo Health
82
Technical
73
Dependency
Built with
Python 82%
Updated 1 weeks ago
Python
94%
Apache 2.0

SWIRL

Data Engineering · Databases · Search

3,046

Federated AI search and RAG across 100+ enterprise sources—no data extraction, no vector database required.

View details
61
Repo Health
83
Technical
65
Dependency
Built with
Python 94%
Updated 1 weeks ago
C
74%
AGPL 3.0

TDengine

Databases

25,168

A high-performance, open-source time-series database built in C for IoT, connected vehicles, and industrial monitoring workloads, with built-in stream processing, caching, and data subscription.

View details
97
Repo Health
71
Technical
65
Dependency
Built with
C 74%
C++ 19%
Updated 1 weeks ago
Python
73%
Apache 2.0

Unsloth

AI Assistants · AI Development

78,493

Run and fine-tune LLMs, diffusion, audio and embedding models on your own hardware, from a native desktop app, a browser UI, or a Python library.

View details
89
Repo Health
83
Technical
70
Dependency
Built with
Python 73%
TypeScript 22%
Updated 6 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers