markdown-it-py

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

Library
PyPI
v4.2.0
1,370 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
83 /100 Excellent
Development Activity 84
Maintenance 84
Community 64
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

Python
100%
Apache 2.0

Agno

AI Development · Automation · Devops

42,358

Build, run, and manage agent platforms with a full production stack — SDK, runtime, and control plane included.

View details
93
Repo Health
87
Technical
66
Dependency
Built with
Python 100%
Updated 5 days ago
Python
59%
Apache 2.0

argilla

AI Development · Data Engineering

5,125

Collaborate on high-quality AI training data with a self-hosted annotation platform built for LLMs, NLP, and multimodal models.

View details
65
Repo Health
81
Technical
61
Dependency
Built with
Python 59%
Jupyter Notebook 21%
Updated 1 weeks ago
C++
68%
Apache 2.0

ClickHouse

Analytics · Data Engineering · Databases

50,116

Open-source column-oriented database that delivers real-time analytical queries on petabyte-scale data with millisecond latency.

View details
95
Repo Health
90
Technical
64
Dependency
Built with
C++ 68%
Python 14%
Updated 5 days ago
Rust
52%
Apache 2.0

cocoindex

AI Development · Data Engineering

11,607

An incremental data indexing engine that keeps AI agent context perpetually fresh by reprocessing only what changed.

View details
87
Repo Health
85
Technical
65
Dependency
Built with
Rust 52%
Python 48%
Updated 5 days ago
Go
32%
Apache 2.0

CubeSandbox

AI Agents · Developer Tools · Security

12,728

Instant, concurrent, hardware-isolated MicroVM sandboxes for AI agents — E2B-API compatible, sub-60ms cold starts, and a built-in zero-trust egress proxy, all self-hostable at scale.

View details
82
Repo Health
88
Technical
63
Dependency
Built with
Go 32%
Rust 26%
C 22%
Updated 1 weeks ago
Python
51%
AGPL 3.0

Khoj

AI Assistants · Knowledge Management · Productivity

37,526

A self-hostable AI second brain that chats with your documents, searches the web, builds custom agents, and runs entirely on your own LLM.

View details
63
Repo Health
82
Technical
66
Dependency
Built with
Python 51%
TypeScript 36%
Updated 2 months ago
Python
86%
Apache 2.0

knowhere

AI Development · AI Memory · Developer Tools

3,541

Transform messy, unstructured documents into persistent, navigable memory that AI agents can actually use.

View details
82
Repo Health
75
Technical
66
Dependency
Built with
Python 86%
HTML 14%
Updated 1 weeks ago
Python
62%
Apache 2.0

marimo

Data Engineering · Developer Tools

22,918

A reactive Python notebook that eliminates hidden state, runs reproducibly, and deploys as a web app or script — stored as pure Python, built for the AI era.

View details
89
Repo Health
91
Technical
65
Dependency
Built with
Python 62%
TypeScript 37%
Updated 6 days ago
Python
65%
Apache 2.0

Polar

Developer Tools · Ecommerce · Invoicing Finance

10,293

Open source payments infrastructure that turns software into a business — subscriptions, usage-based billing, digital products, and merchant-of-record compliance in one platform.

View details
90
Repo Health
82
Technical
66
Dependency
Built with
Python 65%
TypeScript 28%
Updated 5 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