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).

Metadata

Release files for multimark 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for multimark 0.4.0
File Size Uploaded
multimark-0.4.0.tar.gz 1.5 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for multimark 0.4.0
File
multimark-0.4.0-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
multimark-0.4.0-cp39-abi3-pyemscripten_2026_0_wasm32.whl CPython 3.9 abi3 PyEmscripten 2026.0+ WebAssembly Details
multimark-0.4.0-cp39-abi3-musllinux_1_2_x86_64.whl CPython 3.9 abi3 Linux musl 1.2+ x86-64 Details
multimark-0.4.0-cp39-abi3-musllinux_1_2_aarch64.whl CPython 3.9 abi3 Linux musl 1.2+ ARM64 Details
multimark-0.4.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details
multimark-0.4.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details
multimark-0.4.0-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details
multimark-0.4.0-cp39-abi3-macosx_10_9_x86_64.whl CPython 3.9 abi3 macOS 10.9+ x86-64 Details

Total release size: 4.0 MB

Release files / multimark-0.4.0.tar.gz

Download URL multimark-0.4.0.tar.gz
Size 1.5 MB
Tags Source
SHA-256 checksum
How to use checksums
74522c5a91079343847f04d80d21b59f7ef05ffc9c6c2d0da1d3528630d702db
BLAKE2b-256 checksum
How to use checksums
d917cffecf6e6bcaa6453c4782e4bed80d0e06e5e0ba172b8cfc2ba57c6342e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / multimark-0.4.0-cp39-abi3-win_amd64.whl

Download URL multimark-0.4.0-cp39-abi3-win_amd64.whl
Size 140.5 kB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
78fcd127f4a8de3dd5b814a71e754b519657d58744741c4b47f835b8607fbf39
BLAKE2b-256 checksum
How to use checksums
ba65efecdc71656adb1102897557f66bc4868e3843ba3a942de05fdd7711fa9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / multimark-0.4.0-cp39-abi3-pyemscripten_2026_0_wasm32.whl

Download URL multimark-0.4.0-cp39-abi3-pyemscripten_2026_0_wasm32.whl
Size 116.6 kB
Tags CPython 3.9 PyEmscripten 2026.0+ WebAssembly abi3
SHA-256 checksum
How to use checksums
6995e3dd0f22cdcbef1285a9641f1a4b20a8ef2b33e106e53a986cc0cc754ff2
BLAKE2b-256 checksum
How to use checksums
12ff49a1fef0d6b8fade74bf4d38138b3684c83c3128210ad46680328c7de772
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / multimark-0.4.0-cp39-abi3-musllinux_1_2_x86_64.whl

Download URL multimark-0.4.0-cp39-abi3-musllinux_1_2_x86_64.whl
Size 501.7 kB
Tags CPython 3.9 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
025997f9ce2f640863a16c81cf7c4822b6922a044d2e65461b394724fa19ed6a
BLAKE2b-256 checksum
How to use checksums
013318e9ad0ec38c3d18aebf30821849660b3d8117857086f3c0a1e0ac00bb24
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / multimark-0.4.0-cp39-abi3-musllinux_1_2_aarch64.whl

Download URL multimark-0.4.0-cp39-abi3-musllinux_1_2_aarch64.whl
Size 495.9 kB
Tags CPython 3.9 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
d195900df1d9658b5f5f1c3a878df50e1d1d2b65fe3207573d3c8189db19353a
BLAKE2b-256 checksum
How to use checksums
edcfb901860e4dacc26528a9335a162132bdd518d1c10f8f60b1bf0cfb9f85f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / multimark-0.4.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL multimark-0.4.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 499.8 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
d01e1f05ff9dedfa5cf59d88c6024b41b991cf56e778c12cb91b3f408933ef2b
BLAKE2b-256 checksum
How to use checksums
6e17556451fb9294df13779787f65257f28fb296b8868b3615572918948f449a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / multimark-0.4.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL multimark-0.4.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 493.2 kB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
50d7f34540b642b3f0c4a98959e21626ef44c7e0c7f0f0d456b3f07f0c8c8e6d
BLAKE2b-256 checksum
How to use checksums
7bb9d8394d44df2e0f66a33fa3b344968fc1c7fb37bf78f1637c0f36627a6796
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / multimark-0.4.0-cp39-abi3-macosx_11_0_arm64.whl

Download URL multimark-0.4.0-cp39-abi3-macosx_11_0_arm64.whl
Size 148.1 kB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
3a446f7079bebb82a5dbc9d7bf7abe07a44db60f72ef29706b0d556fb657bad2
BLAKE2b-256 checksum
How to use checksums
2dc417ad4f6ba0bc951ec6d7835eb827cb5f6d84d54da9ba5017c091f938938f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / multimark-0.4.0-cp39-abi3-macosx_10_9_x86_64.whl

Download URL multimark-0.4.0-cp39-abi3-macosx_10_9_x86_64.whl
Size 152.5 kB
Tags CPython 3.9 abi3 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
0af429f7614ebd1898a18fdf0cc96c9216432515f91ead436bb9e04a950c89a6
BLAKE2b-256 checksum
How to use checksums
348af6ec315538f8eead169cb2266a5d5d9458208eb371821af8a9facc2625b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

0.4.0 This release

9 release files

0.3.2

6 release files

0.3.1

4 release files

0.3.0

4 release files

0.1.3

26 release 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