Python-Markdown

3.10.2 · active · verified Sat Mar 28

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

Install

Imports

Quickstart

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)

view raw JSON →