Install & Compatibility
Where this runs
tested against v3.10.3 · 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.144s · 18.5MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 1.7s · import 0.136s · 19MB
17MB installed
● package 17MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
markdown
✓ import markdown
The primary interface is the 'markdown' module itself, often used via the `markdown.markdown()` function or by instantiating `markdown.Markdown`.
Initialize the Markdown parser with optional extensions and convert a Markdown string to HTML. Extensions like 'fenced_code' for code blocks and 'tables' for table support are commonly used.
import markdown
markdown_text = """
# My Title
This is **bold** and *italic* text.
- Item 1
- Item 2
"""
html_output = markdown.markdown(markdown_text, extensions=['fenced_code', 'tables'])
print(html_output)
markdown_py --version
Debug
Known issues
breakingPython 3.9 support was officially dropped in Python-Markdown 3.10.0. Users on Python 3.9 or older must use a version prior to 3.10.0.fixUpgrade to Python 3.10+ or pin `markdown<3.10.0` if unable to upgrade Python.
affects: >=3.10.0
gotchaThe default footnote ordering behavior changed in 3.9.0 (to order by reference appearance) but was reverted to definition order (`USE_DEFINITION_ORDER=True`) in 3.10.0 due to inconsistencies. If you upgraded from <3.9 to 3.9.x and relied on the new default, then upgraded to 3.10.x, your footnote order may have unexpectedly reverted.fixExplicitly set the `USE_DEFINITION_ORDER` option in the footnotes extension (e.g., `extensions=['footnotes(USE_DEFINITION_ORDER=False)']`) to ensure consistent behavior across versions.
affects: 3.9.x to 3.10.x
deprecatedThe `AbbrInlineProcessor` class and the `AbbrPreprocessor` class (renamed from `AbbrBlockprocessor`) were deprecated in version 3.7 as part of a refactor of the abbreviation extension. Custom code subclassing these will break.fixUpdate custom abbreviation extension code to use the new `AbbrTreeprocessor` and `AbbrBlockprocessor` (which `AbbrPreprocessor` was renamed to) as described in the release notes or documentation.
affects: >=3.7
gotchaSeveral patch releases (e.g., 3.8.1, 3.8.2, 3.10.1, 3.10.2) have fixed critical infinite loop vulnerabilities and parsing crashes when processing malformed HTML comments or incomplete tags, especially in newer Python versions like 3.14. Untrusted input could lead to denial-of-service.fixAlways ensure you are using the latest patch release (e.g., `3.10.2`) to benefit from critical parsing and security fixes, especially when processing user-provided Markdown.
affects: <3.10.2 (and various older patch releases)
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'markdown'
The 'markdown' library or one of its extensions is not installed in the active Python environment, or the Python interpreter cannot find it due to incorrect environment paths or a conflicting local file.
fixInstall the library using pip: `pip install markdown`. If using extensions, ensure they are also installed, for example: `pip install markdown[extra]` or `pip install pymdown-extensions`.
AttributeError: 'module' object has no attribute 'Markdown'
This usually happens when a user attempts to call 'markdown.Markdown()' as a constructor, but either a different 'markdown' module is imported (e.g., a local file named 'markdown.py' shadowing the installed library) or they are trying to access a non-existent attribute.
fixEnsure you are importing the correct 'markdown' library and use the `markdown.markdown()` function for simple conversion, or correctly instantiate the `Markdown` class if using the advanced API: `import markdown; html = markdown.markdown(text)` or `from markdown import Markdown; md = Markdown(); html = md.convert(text)`.
AttributeError: 'module' object has no attribute 'version'
This error occurs because the way to access the library's version information changed in Python-Markdown version 3.0. Older code tries to use `markdown.version`.
fixAccess the version string using the standard Python module attribute: `markdown.__version__`.
ImportError: cannot import name 'etree' from 'markdown.util'
This indicates a dependency conflict or an outdated extension attempting to import a utility function ('etree') from an internal module path ('markdown.util') that has either been removed or refactored in newer versions of Python-Markdown.
fixUpdate Python-Markdown to the latest version (`pip install --upgrade markdown`) and ensure all installed extensions are compatible and up-to-date. If the issue persists, the problematic extension might need to be updated or replaced if it has not adapted to internal API changes.
AttributeError: module 'markdown' has no attribute 'Markdown'
Users often incorrectly assume a class-based interface (e.g., `Markdown().convert()`) when the library provides a direct function call for conversion.
fixUse the top-level `markdown.markdown()` function directly: `import markdown; html = markdown.markdown(text)`
Upgrade
Version history
3.10.3latest on PyPI · released Jul 30, 2026
Audit
Dependencies
No dependency data recorded yet.