Skip to main content

multimark

PyPI Python versions Downloads MIT License CI

The multimark package has Python bindings to cmark-gfm, the C reference implementation of CommonMark with GitHub Flavored Markdown extensions.

Renders Markdown to HTML, LaTeX, groff man, XML, and normalized CommonMark: all from a single, lightweight package.

Installation

pip install multimark

Wheels are available for Linux, macOS, and Windows (Python 3.9+). No system dependencies required.

Quick Start

from multimark import markdown_to_html, markdown_to_latex

html = markdown_to_html("**Hello**, *world*!")
# '<p><strong>Hello</strong>, <em>world</em>!</p>\n'

latex = markdown_to_latex("**Hello**, *world*!")
# '\\textbf{Hello}, \\emph{world}!\n'

Renderers

Function Output Format
markdown_to_html() HTML
markdown_to_latex() LaTeX
markdown_to_man() groff man page
markdown_to_commonmark() Normalized CommonMark
markdown_to_xml() XML (AST representation)

Options

Use named boolean keyword arguments for common settings:

from multimark import markdown_to_html, markdown_to_latex

# Smart punctuation (curly quotes, em-dashes)
markdown_to_html('"Hello" -- world...', smart=True)
# '<p>\u201cHello\u201d \u2013 world\u2026</p>\n'

# Allow raw HTML passthrough (safe mode is the default)
markdown_to_html('<div>hi</div>', unsafe=True)
# '<div>hi</div>\n'

# Source position attributes
markdown_to_html('**Hello**', sourcepos=True)
# '<p data-sourcepos="1:1-1:9"><strong>Hello</strong></p>\n'

# Line wrapping (LaTeX, man, and commonmark renderers)
markdown_to_latex('**Hello**, *world*!', width=80)
# '\\textbf{Hello}, \\emph{world}!\n'

# Footnotes
markdown_to_html('Text[^1]\n\n[^1]: A footnote\n', footnotes=True)
# '<p>Text<sup class="footnote-ref">...</sup></p>\n<section class="footnotes">...\n'

Or compose flags with the Options bitmask:

from multimark import markdown_to_html, Options

html = markdown_to_html(text, options=Options.SMART | Options.UNSAFE)

GFM Extensions

Enable GitHub Flavored Markdown extensions by name:

from multimark import markdown_to_html

# Tables
markdown_to_html('| A | B |\n|---|---|\n| 1 | 2 |\n', extensions=["table"])
# '<table>\n<thead>\n<tr>\n<th>A</th>\n<th>B</th>\n</tr>...\n'

# Strikethrough
markdown_to_html('~~deleted~~', extensions=["strikethrough"])
# '<p><del>deleted</del></p>\n'

# Multiple extensions
html = markdown_to_html(text, extensions=["table", "strikethrough", "autolink", "tasklist", "tagfilter"])

Available extensions: table, strikethrough, autolink, tagfilter, tasklist.

All Renderer Parameters

Every renderer accepts:

  • text: Markdown string
  • options: raw bitmask (default 0)
  • extensions: list of GFM extension names (default ())
  • smart: smart punctuation
  • hardbreaks: render soft breaks as <br>
  • unsafe: allow raw HTML
  • normalize: consolidate adjacent text nodes
  • footnotes: enable footnote syntax

Additional parameters:

  • sourcepos: Source position attributes (HTML and XML only)
  • width: Line wrap column (LaTeX, man, and commonmark only; 0 = no wrap)

Why multimark?

Several Python packages wrap cmark or provide CommonMark parsing. Here's how they compare:

multimark cmarkgfm commonmark.py
Engine cmark-gfm (C, vendored) cmark-gfm (C, vendored) Pure Python
Output formats HTML, LaTeX, man, XML, CommonMark HTML only HTML only
GFM extensions
Safe by default
Convenience kwargs smart=True, unsafe=True, etc. Raw bitmask only N/A
Performance Fastest (14% faster than cmarkgfm) Fast ~31× slower
Maintained Active (2026) Active (2025) Unmaintained (2019)

multimark uses the same battle-tested C library as cmarkgfm but exposes all five of cmark's output formats (not just HTML). The API is designed around keyword arguments rather than opaque bitmasks, and unsafe content is blocked by default so the safe choice requires no extra configuration.

Thanks to extension pointer caching and reduced Python-side overhead, multimark is the fastest Python Markdown-to-HTML library. Take a look at the benchmarks for more detail on this.

License

MIT and BSD-2-Clause (cmark-gfm).

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

multimark-0.3.2.tar.gz (1.5 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

multimark-0.3.2-cp39-abi3-win_amd64.whl (137.6 kB view details)

Uploaded CPython 3.9+Windows x86-64

multimark-0.3.2-cp39-abi3-musllinux_1_2_x86_64.whl (497.3 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ x86-64

multimark-0.3.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (495.4 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

multimark-0.3.2-cp39-abi3-macosx_11_0_arm64.whl (145.1 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

multimark-0.3.2-cp39-abi3-macosx_10_9_x86_64.whl (149.4 kB view details)

Uploaded CPython 3.9+macOS 10.9+ x86-64

File details

Details for the file multimark-0.3.2.tar.gz.

File metadata

  • Download URL: multimark-0.3.2.tar.gz
  • Upload date:
  • Size: 1.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for multimark-0.3.2.tar.gz
Algorithm Hash digest
SHA256 49da83d04d590fdf93799b724881657d493e2bfb2b2159e9d50bce06d58ce13f
MD5 95b9a4fd94b85bea10e7045974c6c5b9
BLAKE2b-256 bd7bd02dc88929047e1d7ac9d0c9390bf2dc2b34618c050fbc1f866a3ede42a3

See more details on using hashes here.

File details

Details for the file multimark-0.3.2-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: multimark-0.3.2-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 137.6 kB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for multimark-0.3.2-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 2039c7278cb7cad4b587b046f7af686a4f321e5b6265fb0dec9f10d104cbdc6a
MD5 fcba88ff5bbb4ed7254e9f40c8327c54
BLAKE2b-256 1aabf534d8b8a1db1e00ae25254dcba64c220b7af50aefe11e584d54bd45d0ec

See more details on using hashes here.

File details

Details for the file multimark-0.3.2-cp39-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for multimark-0.3.2-cp39-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 810378ee8ca9edbb1539db29a21c5b526319f1ac952acddd6a26338b83aac53e
MD5 f2e6b41e484484bb403a28b5eb85dc62
BLAKE2b-256 1b18b7a4a284bb613ac2533aa5fdbae11f0d2a352d23c5a1be306231447a16fc

See more details on using hashes here.

File details

Details for the file multimark-0.3.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for multimark-0.3.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8a5f712d27bc376f1b56a7e124253f32ba723129dd710b14036314038a8967dc
MD5 b9c71688a709f250b4215570466555cc
BLAKE2b-256 e60f5f8f31ef2fb8f3e82f07fd0567a4b0c9ab8c863a1c47aacb7eded43d607f

See more details on using hashes here.

File details

Details for the file multimark-0.3.2-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for multimark-0.3.2-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0a26acd0d1e2a0f0aca04b3705da73ec7a9d712c28201df7b7da92f721db153c
MD5 287935da35bafbdf4362a81fbfeb7730
BLAKE2b-256 1d9c3087e95e4aa3d8e9f4437d3c0af6d553a67539dff178ccbf4fedd967402e

See more details on using hashes here.

File details

Details for the file multimark-0.3.2-cp39-abi3-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for multimark-0.3.2-cp39-abi3-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 29e66b4da18404d70c848003a43b8be29f9b48e9cd9671f06343e634a7383d70
MD5 4db333648bba3255471e5cd175dd0ca9
BLAKE2b-256 47810566e6200bf677f636805f32bf83705b5b060840605adb390218dd0cc3db

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.3.2 This release

6 files

0.3.1

4 files

0.3.0

4 files

0.2.0

26 files

0.1.3

26 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page