mistletoe
A fast, extensible Markdown parser in pure Python.
What it is and what it does
mistletoe parses Markdown into an abstract syntax tree (AST) and renders it to multiple output formats. It implements the CommonMark specification for predictable, spec-compliant parsing, and supports native extensions like strikethrough and tables. The design separates parsing from rendering, so you can swap renderers without modifying core logic.
The package ships with built-in renderers for HTML, LaTeX, AST (for debugging), and Markdown (for reflowing or automated edits). Additional renderers for MathJax, Pygments highlighting, GitHub wiki links, Jira, XWiki, and Scheme are available in a contrib package. It works as both a Python library and a command-line tool, and includes an interactive REPL mode for testing.
Use it for:
- Convert Markdown files to HTML or LaTeX for documentation generation or publishing workflows.
- Parse Markdown into an AST to programmatically inspect or transform document structure.
- Reflow Markdown text to a specific line length or apply automated edits to Markdown documents.
- Build custom renderers for domain-specific output formats by extending the parser's token system.
- Use the command-line tool to batch-convert Markdown files without writing Python code.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
mistletoe is a pure-Python Markdown parser that converts Markdown documents into an abstract syntax tree, then renders them to HTML, LaTeX, Markdown, or custom formats via pluggable renderers.
Yes. mistletoe is actively maintained, has no dependencies, installs with low friction, carries no known vulnerabilities, and offers a clean API for both library and CLI use. Install it if you need CommonMark-compliant Markdown parsing with extensible rendering or if you want to programmatically manipulate Markdown documents.
Install
mistletoe on PyPI
pip
pip install mistletoeuv
uv add mistletoepoetry
poetry add mistletoeInstalling mistletoe
Before you install
Low friction: pure Python with no runtime dependencies, distributed as a wheel, and actively maintained with a recent release.
License in practice
MIT license permits commercial and private use with minimal restrictions; you must include a copy of the license in distributions.
Quickstart
pip install mistletoe
import mistletoe
with open('foo.md', 'r') as fin:
rendered = mistletoe.markdown(fin)
Verify before relying
- Whether performance claims ('fastest CommonMark implementation in pure Python') are independently verified or benchmarked.
- Whether custom token definitions and renderer extensions are documented with examples beyond the description excerpt.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (~=3.5) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 34 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,251,437/month — #3,188 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: mistletoe-1.6.0-py3-none-any.whl
Keywords: markdown, lexer, parser, development
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
mistuneMistune converts Markdown text to HTML using a…
permissive · top 1,000 on PyPI
commonmarkParses Markdown text according to the…
permissive · top 5,000 on PyPI
markdown-it-pyA Python markdown parser that converts markdown…
permissive · top 100 on PyPI
markdown-it-pyrsA Rust-backed Python Markdown parser that…
permissive · top 15,000 on PyPI
myst-parserMyST-Parser extends CommonMark-compliant…
permissive · top 5,000 on PyPI
tree-sitter-markdownProvides a tree-sitter grammar for parsing…
permissive · top 5,000 on PyPI
markoMarko is a pure Python markdown parser that…
permissive · top 5,000 on PyPI
rich-text-rendererConverts Contentful RichText field data into…
permissive · top 15,000 on PyPI
multimarkConverts Markdown to HTML, LaTeX, groff man,…
permissive · top 15,000 on PyPI
pystachePystache renders Mustache templates—a…
permissive · top 5,000 on PyPI