{"id":299,"library":"markdown-it-py","title":"markdown-it-py","description":"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.","status":"active","version":"4.0.0","language":"python","source_language":"en","source_url":"https://github.com/executablebooks/markdown-it-py","tags":["markdown","parser","commonmark","markdown-it","python"],"install":[{"cmd":"pip install markdown-it-py","lang":"bash","label":"Install markdown-it-py"}],"dependencies":[{"reason":"URL parsing","package":"mdurl","optional":false},{"reason":"Enables automatic link recognition","package":"linkify-it-py","optional":true}],"imports":[{"note":"The correct import is from the markdown_it module, not markdown_it_py.","wrong":"from markdown_it_py import MarkdownIt","symbol":"MarkdownIt","correct":"from markdown_it import MarkdownIt"}],"quickstart":{"code":"from markdown_it import MarkdownIt\n\nmd = MarkdownIt()\ntext = \"# Hello World\\n\\nThis is a paragraph with **bold** and *italic* text.\"\nhtml = md.render(text)\nprint(html)","lang":"python","description":"This example demonstrates how to convert a Markdown string to HTML using markdown-it-py."},"warnings":[{"fix":"Upgrade your Python environment to version 3.10 or later.","message":"Dropped support for Python 3.8 and 3.9 in version 4.0.0.","severity":"breaking","affected_versions":"4.0.0 and above"},{"fix":"Review your Markdown content to ensure compatibility with the updated parsing rules.","message":"Updated parser to comply with CommonMark 0.31.2 and Markdown-It v14.1.0, which may affect parsing behavior.","severity":"breaking","affected_versions":"4.0.0 and above"},{"fix":"Update your code to use StateBase.src instead of StateBase.srcCharCode.","message":"The use of StateBase.srcCharCode is deprecated; replaced by StateBase.src.","severity":"deprecated","affected_versions":"3.0.0 and above"},{"fix":"Install the optional dependency using pip install markdown-it-py[linkify].","message":"The linkify feature requires the optional linkify-it-py dependency.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-05-12T12:56:22.217Z","next_check":"2026-06-26T00:00:00.000Z","problems":[{"fix":"Ensure the library is installed using pip: `pip install markdown-it-py`. Then, import it as `from markdown_it import MarkdownIt`.","cause":"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').","error":"ModuleNotFoundError: No module named 'markdown_it'"},{"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`.","cause":"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.","error":"ImportError: cannot import name 'some_plugin' from 'mdit_py_plugins'"},{"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`.","cause":"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`.","error":"GitHub Flavored Markdown (GFM) features like tables or autolinking are not rendered correctly when using the 'gfm-like' preset."},{"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.","cause":"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.","error":"AttributeError: 'MarkdownIt' object has no attribute 'rules' (or similar attribute for internal parser components)"}],"ecosystem":"pypi","meta_description":null,"install_score":100,"install_tag":"verified","quickstart_score":80,"quickstart_tag":"verified","pypi_latest":null,"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":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.16,"mem_mb":3.6,"disk_size":"18.6M"},{"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.14,"mem_mb":3.6,"disk_size":"19M"},{"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.27,"mem_mb":4.1,"disk_size":"20.5M"},{"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.22,"mem_mb":4.1,"disk_size":"21M"},{"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.22,"mem_mb":3.9,"disk_size":"12.4M"},{"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.23,"mem_mb":3.9,"disk_size":"13M"},{"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.2,"mem_mb":4.6,"disk_size":"12.0M"},{"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.2,"mem_mb":4.5,"disk_size":"13M"},{"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.13,"mem_mb":3.6,"disk_size":"18.1M"},{"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.11,"mem_mb":3.6,"disk_size":"19M"}]},"quickstart_checks":{"last_tested":"2026-04-23","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}]}}