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
muslpy 3.10–3.915 runs
installs and imports cleanly · install 0.0s · import 0.096s · 26.9MB
glibcpy 3.10–3.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.fixConsider `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.fixRefer 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.fixUpgrade 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.fixInstantiate `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`.fixInstall 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.