Skip to content

pyromark

A CommonMark-compliant Markdown parser for Python, built on the pulldown-cmark Rust crate.

  • 2.6 times faster than cmarkgfm and comrak, and 86 to 367 times faster than pure Python parsers (benchmark).
  • Supports tables, footnotes, task lists, math, GitHub alerts and other extensions.
  • Highlights code in about 190 languages with bundled themes, so you don't need Pygments.
  • Every event is typed, so your editor knows its shape.
  • Releases the GIL while rendering, so threads render in parallel.

Install

uv add pyromark
pip install -U pyromark

Python 3.11+ on Linux, macOS and Windows, including PyPy and free-threaded builds.

Quick start

import pyromark

html = pyromark.html("# Hello *world*")
assert html == "<h1>Hello <em>world</em></h1>\n"

The output is not sanitized

Raw HTML and javascript: links pass through, as CommonMark requires. Clean the output of Markdown you did not write, for example with nh3.

Next

  • Guide: extensions, code highlighting, links, threads.
  • Events: walk the document to build a table of contents, collect links or extract text.
  • CLI: convert files from the terminal.
  • API reference: every function, class and type.