Python-Markdown converts Markdown text to HTML following John Gruber’s syntax, with an extension API and an optional command-line wrapper.
Overview
Python-Markdown is a Python package that parses Markdown into HTML for use in applications or scripts. It aims to match the reference markdown.pl behavior with documented edge-case differences such as middle-word emphasis, list indentation rules, consecutive lists, and automatic link detection.
The library accepts Unicode input, supports optional extensions that alter syntax or add features, and can emit HTML or XHTML-style tags. An Extension API lets developers register custom parsers and post-processors. Design goals include behaving safely in server environments by avoiding uncaught exceptions and not writing to stdout when used as a library.
The same project provides a CLI for converting files from the shell. Python-Markdown explicitly follows Gruber’s rules rather than the separate CommonMark specification.
Key features
- Gruber Markdown parsing
- Extension API
- Bundled optional extensions
- HTML and XHTML output
- Unicode document input
- Optional CLI converter
- Configurable tab and list rules
Use cases
- Render Markdown in Python web apps
- Add custom Markdown syntax via extensions
- Convert Markdown files from the shell
- Generate HTML docs from text sources