{"id":656,"library":"markdown","title":"Python-Markdown","description":"Python-Markdown is a full Python implementation of John Gruber's Markdown, providing a highly customizable parser for converting Markdown text to HTML. It is currently at version 3.10.2 and maintains an active release cadence, frequently addressing bug fixes, performance improvements, and Python version compatibility.","status":"active","version":"3.10.2","language":"python","source_language":"en","source_url":"https://github.com/Python-Markdown/markdown","tags":["markdown","html","parser","documentation","rendering"],"install":[{"cmd":"pip install markdown","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"note":"The primary interface is the 'markdown' module itself, often used via the `markdown.markdown()` function or by instantiating `markdown.Markdown`.","symbol":"markdown","correct":"import markdown"}],"quickstart":{"code":"import markdown\n\nmarkdown_text = \"\"\"\n# My Title\n\nThis is **bold** and *italic* text.\n\n- Item 1\n- Item 2\n\"\"\"\n\nhtml_output = markdown.markdown(markdown_text, extensions=['fenced_code', 'tables'])\nprint(html_output)","lang":"python","description":"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."},"warnings":[{"fix":"Upgrade to Python 3.10+ or pin `markdown<3.10.0` if unable to upgrade Python.","message":"Python 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.","severity":"breaking","affected_versions":">=3.10.0"},{"fix":"Explicitly set the `USE_DEFINITION_ORDER` option in the footnotes extension (e.g., `extensions=['footnotes(USE_DEFINITION_ORDER=False)']`) to ensure consistent behavior across versions.","message":"The 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.","severity":"gotcha","affected_versions":"3.9.x to 3.10.x"},{"fix":"Update custom abbreviation extension code to use the new `AbbrTreeprocessor` and `AbbrBlockprocessor` (which `AbbrPreprocessor` was renamed to) as described in the release notes or documentation.","message":"The `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.","severity":"deprecated","affected_versions":">=3.7"},{"fix":"Always 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.","message":"Several 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.","severity":"gotcha","affected_versions":"<3.10.2 (and various older patch releases)"}],"env_vars":null,"last_verified":"2026-05-12T17:23:21.125Z","next_check":"2026-06-26T00:00:00.000Z","problems":[{"fix":"Install 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`.","cause":"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.","error":"ModuleNotFoundError: No module named 'markdown'"},{"fix":"Ensure 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)`.","cause":"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.","error":"AttributeError: 'module' object has no attribute 'Markdown'"},{"fix":"Access the version string using the standard Python module attribute: `markdown.__version__`.","cause":"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`.","error":"AttributeError: 'module' object has no attribute 'version'"},{"fix":"Update 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.","cause":"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.","error":"ImportError: cannot import name 'etree' from 'markdown.util'"},{"fix":"Use the top-level `markdown.markdown()` function directly: `import markdown; html = markdown.markdown(text)`","cause":"Users often incorrectly assume a class-based interface (e.g., `Markdown().convert()`) when the library provides a direct function call for conversion.","error":"AttributeError: module 'markdown' has no attribute 'Markdown'"}],"ecosystem":"pypi","meta_description":null,"install_score":100,"install_tag":"verified","quickstart_score":80,"quickstart_tag":"verified","pypi_latest":"3.10.2","install_checks":{"last_tested":"2026-05-12","tag":"verified","tag_description":"installs cleanly on critical runtimes, fast import, recently tested","results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":null,"import_time_s":0.14,"mem_mb":5.7,"disk_size":"18.5M"},{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.13,"mem_mb":5.7,"disk_size":"18.5M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":1.6,"import_time_s":0.12,"mem_mb":5.7,"disk_size":"19M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.13,"mem_mb":5.7,"disk_size":"19M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":null,"import_time_s":0.18,"mem_mb":5.9,"disk_size":"20.5M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.2,"mem_mb":5.9,"disk_size":"20.5M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":1.6,"import_time_s":0.15,"mem_mb":5.9,"disk_size":"21M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.15,"mem_mb":5.9,"disk_size":"21M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":null,"import_time_s":0.15,"mem_mb":5.8,"disk_size":"12.3M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.16,"mem_mb":5.8,"disk_size":"12.3M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":1.5,"import_time_s":0.15,"mem_mb":5.8,"disk_size":"13M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.15,"mem_mb":5.8,"disk_size":"13M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":null,"import_time_s":0.14,"mem_mb":6.1,"disk_size":"12.0M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.15,"mem_mb":6.1,"disk_size":"11.9M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":1.5,"import_time_s":0.14,"mem_mb":5.9,"disk_size":"13M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.15,"mem_mb":5.9,"disk_size":"12M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":null,"import_time_s":0.09,"mem_mb":5.6,"disk_size":"18.3M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.11,"mem_mb":5.6,"disk_size":"18.3M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":2,"import_time_s":0.08,"mem_mb":5.6,"disk_size":"19M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.09,"mem_mb":5.6,"disk_size":"19M"}]},"quickstart_checks":{"last_tested":"2026-04-24","tag":"verified","tag_description":"quickstart runs on critical runtimes, recently tested","results":[{"runtime":"python:3.10-alpine","exit_code":0},{"runtime":"python:3.10-slim","exit_code":0},{"runtime":"python:3.11-alpine","exit_code":0},{"runtime":"python:3.11-slim","exit_code":0},{"runtime":"python:3.12-alpine","exit_code":0},{"runtime":"python:3.12-slim","exit_code":0},{"runtime":"python:3.13-alpine","exit_code":0},{"runtime":"python:3.13-slim","exit_code":0},{"runtime":"python:3.9-alpine","exit_code":0},{"runtime":"python:3.9-slim","exit_code":0}]}}