Python-Markdown
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.
Warnings
- breaking 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.
- gotcha 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.
- deprecated 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.
- gotcha 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.
Install
-
pip install markdown
Imports
- markdown
import markdown
Quickstart
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)