Install & Compatibility
Where this runs
tested against v4.2.0 · 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.95 runs
installs and imports cleanly · install 0.0s · import 0.188s · 18.6MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 1.8s · import 0.180s · 19MB
17MB installed
● package 17MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
MarkdownIt
✓ from markdown_it import MarkdownIt
✗ from markdown_it_py import MarkdownIt
The correct import is from the markdown_it module, not markdown_it_py.
This example demonstrates how to convert a Markdown string to HTML using markdown-it-py.
from markdown_it import MarkdownIt
md = MarkdownIt()
text = "# Hello World\n\nThis is a paragraph with **bold** and *italic* text."
html = md.render(text)
print(html)
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'markdown_it'
The markdown-it-py library is not installed in your Python environment, or you are attempting to import it with an incorrect module name (e.g., 'markdown-it' instead of 'markdown_it').
fixEnsure the library is installed using pip: `pip install markdown-it-py`. Then, import it as `from markdown_it import MarkdownIt`.
ImportError: cannot import name 'some_plugin' from 'mdit_py_plugins'
You are trying to import a plugin (e.g., `front_matter_plugin`, `footnote_plugin`) that is part of the `mdit-py-plugins` collection, but this package is not installed or the plugin name is misspelled.
fixInstall the `mdit-py-plugins` package: `pip install mdit-py-plugins`. Verify the correct plugin name in your import statement, for example: `from mdit_py_plugins.front_matter import front_matter_plugin`.
GitHub Flavored Markdown (GFM) features like tables or autolinking are not rendered correctly when using the 'gfm-like' preset.
The `gfm-like` parser preset, while enabling GFM-like syntax, specifically requires the `linkify-it-py` package to be installed for linkification, which is not a default dependency of `markdown-it-py`.
fixInstall the `linkify-it-py` package, typically by installing `markdown-it-py` with the `linkify` extra: `pip install markdown-it-py[linkify]` or explicitly `pip install linkify-it-py`.
AttributeError: 'MarkdownIt' object has no attribute 'rules' (or similar attribute for internal parser components)
You are attempting to directly access or modify internal parser rule collections or methods (e.g., `md.parser.inline.rules`) that are not part of the public API, possibly stemming from attempts to port JavaScript `markdown-it` code without adapting to the Python API.
fixInstead of direct manipulation, use the exposed `MarkdownIt` methods like `.enable()`, `.disable()`, or `.use()` for managing rules and extensions. For custom rule creation, follow the plugin development guidelines.
Upgrade
Version history
4.2.0latest on PyPI · released May 7, 2026
Audit
Dependencies
mdurlrequiredURL parsing
linkify-it-pyoptionalEnables automatic link recognition