Registry / serialization / marko
library2.2.4pypypi✓ verified 24d ago

Marko is a pure Python markdown parser, version 2.2.2, designed for high extensibility and strict adherence to CommonMark's spec v0.31.2. It supports Python 3.9 and higher, with its latest release on January 5, 2026. The library offers a flexible extension system for custom features, although its strict compliance can result in slower performance compared to some other parsers.

pip install marko
INSTALL
IMPORT
SIG · MARKO
M
marko
serializationpythonv2.2.4
Install
1.9s avg
Import
96ms
Disk
25MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.2.4 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.915 runs
installs and imports cleanly · install 0.0s · import 0.096s · 26.9MB
glibc
py 3.103.915 runs
installs and imports cleanly · install 1.9s · import 0.095s · 27MB
25MB installed
● package 25MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

convert
from marko import convert
import marko; marko.convert()
Markdown
from marko import Markdown
Parser
from marko import Parser

A basic example demonstrating how to convert Markdown text to HTML using `marko.convert()`. It also includes a brief example of initializing the `Markdown` class with a built-in extension.

import marko markdown_text = """ # Hello Marko! This is **bold** text and *italic* text. - Item 1 - Item 2 ```python print('Hello from a code block') ``` """ html_output = marko.convert(markdown_text) print(html_output) # Example with an extension from marko import Markdown markdown = Markdown(extensions=['footnote']) html_with_footnote = markdown.convert('Footnotes[^1]\n\n[^1]: My footnote.') print(html_with_footnote)
Debug
Known issues
gotchaMarko prioritizes strict CommonMark compliance, which can result in slower performance compared to other Python markdown parsers (e.g., Python-Markdown, Mistune) if raw parsing speed is the primary concern.
fix
Consider `Python-Markdown` or `Mistune` if performance is critical and strict CommonMark compliance is less important.
affects: All versions
breakingThe extension system underwent a significant change in version 0.5.0. Users migrating from older versions (pre-0.5.0) will need to update their extension implementations to the new API.
fix
Refer to the official documentation for the updated extension API when migrating from versions prior to 0.5.0.
affects: <0.5.0
breakingSupport for Python 3.6 was dropped in v1.3.0, and support for Python 3.8 was dropped in v2.2.1. The current version (2.2.2) requires Python 3.9 or higher.
fix
Upgrade your Python environment to 3.9 or newer. Alternatively, pin your `marko` version to a compatible release.
affects: <1.3.0 (for Python 3.6), <2.2.1 (for Python 3.8)
gotchaInstances of the `marko.Markdown` class are not thread-safe. In multi-threaded applications, a new `Markdown` instance should be created for each thread to avoid unexpected behavior.
fix
Instantiate `marko.Markdown()` within each thread or use thread-local storage for instances.
affects: All versions
gotchaCertain built-in extensions, such as 'toc' (Table of Contents) and 'codehilite' (Code Highlight), require additional, optional dependencies (`python-slugify` and `Pygments` respectively). These are not installed by default with `pip install marko`.
fix
Install these extensions with their respective extras, e.g., `pip install marko[toc]` or `pip install marko[codehilite]`.
affects: All versions
Upgrade
Version history
2.2.4latest on PyPI · released Aug 12, 2026
Audit
Dependencies
python-slugifyoptionalRequired for the 'toc' (Table of Contents) extension.
PygmentsoptionalRequired for the 'codehilite' (Code Highlight) extension.
Agent activity
5 hits · last 30 days
node
4
Resources
marko — pip install marko · libregistry