Registry / serialization / markdown-it-py

markdown-it-py

JSON →
library4.2.0pypypi✓ verified 25d ago

markdown-it-py is a Python port of the popular markdown-it library, providing fast and extensible Markdown parsing with full CommonMark compliance. The current version is 4.0.0, released in August 2025, with a release cadence of approximately one major version per year.

pip install markdown-it-py
INSTALL
IMPORT
SIG · MARKDOWN-IT-PY
M
markdown-it-py
serializationpythonv4.2.0
Install
1.8s avg
Import
184ms
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
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
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.188s · 18.6MB
glibc
py 3.103.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)
Debug
Known issues
breakingDropped support for Python 3.8 and 3.9 in version 4.0.0.
fix
Upgrade your Python environment to version 3.10 or later.
affects: 4.0.0 and above
breakingUpdated parser to comply with CommonMark 0.31.2 and Markdown-It v14.1.0, which may affect parsing behavior.
fix
Review your Markdown content to ensure compatibility with the updated parsing rules.
affects: 4.0.0 and above
deprecatedThe use of StateBase.srcCharCode is deprecated; replaced by StateBase.src.
fix
Update your code to use StateBase.src instead of StateBase.srcCharCode.
affects: 3.0.0 and above
gotchaThe linkify feature requires the optional linkify-it-py dependency.
fix
Install the optional dependency using pip install markdown-it-py[linkify].
affects: All versions
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').
fix
Ensure 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.
fix
Install 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`.
fix
Install 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.
fix
Instead 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
Agent activity
5 hits · last 30 days
node
4
Resources
markdown-it-py — pip install markdown-it-py · libregistry