skillfed

mistletoe

A fast, extensible Markdown parser in pure Python.

mistletoe v1.6.0 2.3M downloads/30d#3,188 on PyPI1,061
Permissive license MIT Active released

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 mistletoe

uv

uv add mistletoe

poetry

poetry add mistletoe

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Libraries :: Python ModulesTopic :: Text Processing :: Markup :: Markdown

Tags

markdown parser pythoncommonmark compliant parsermarkdown to html convertermarkdown ast renderermarkdown to latexextensible markdown parsermarkdown document processor
markdown-parserast-renderingcommonmark

More Python Modules packages