Skip to main content

cmark-render

Markdown to HTML in C, using a vendored, statically compiled cmark-gfm.

from cmark_render import Extension, Option, render_html

render_html(
    "| a | b |\n|---|---|\n| ~~old~~ | **new** |",
    extensions=[Extension.TABLE, Extension.STRIKETHROUGH],
)

With no options or extensions, render_html is plain cmark-gfm: CommonMark with its default options, so raw HTML and javascript:-style links are dropped.

Extensions

extensions takes the names of cmark-gfm's core syntax extensions, as Extension members or plain strings. None are attached by default.

Extension Effect
TABLE GFM pipe tables.
STRIKETHROUGH ~~text~~ and ~text~ become <del>.
AUTOLINK Bare www. and https:// URLs become links.
TASKLIST - [ ] and - [x] list items become checkboxes.
TAGFILTER Escapes <script>, <iframe>, <style> and other risky tags even under UNSAFE.

An unknown name raises ValueError, and repeating a name has no extra effect.

Options

options takes cmark-gfm's CMARK_OPT_* flags, as Option members combined with |:

render_html(text, options=Option.SMART | Option.FOOTNOTES)
render_html(text, options=Option.UNSAFE)  # keep raw HTML; sanitize untrusted input
Option Effect
UNSAFE Pass raw HTML and javascript:-style links through. Sanitize the output if the input is untrusted.
STRIKETHROUGH_DOUBLE_TILDE With STRIKETHROUGH, strike through only on ~~, leaving single ~ alone.
SMART Curly quotes, en and em dashes, ellipses.
HARDBREAKS Render soft line breaks as <br />.
NOBREAKS Render soft line breaks as spaces.
SOURCEPOS Add data-sourcepos attributes to block elements.
FOOTNOTES Parse [^1] footnotes.
VALIDATE_UTF8 Accepted, but has no effect: a str always arrives as valid UTF-8.
GITHUB_PRE_LANG Write <pre lang="x"> for fenced code instead of a class on <code>.
FULL_INFO_STRING Keep the rest of a code fence's info string, in data-meta.
LIBERAL_HTML_TAG Be looser about what counts as an inline HTML tag.
TABLE_PREFER_STYLE_ATTRIBUTES With TABLE, align cells with style instead of align.

An unknown bit raises ValueError.

Memory and threads

Every render frees its syntax tree and rendered HTML, so memory stays flat however many documents you render.

It is safe to use with threads and fork(). Renders run without the GIL. Parsing runs one at a time, because cmark-gfm keeps a global table of special characters that changes during each parse, but writing the HTML runs in parallel. A pthread_atfork handler stops a child process from inheriting a held lock.

Install

pip install cmark-render

Wheels are built for CPython 3.14 on macOS arm64 and manylinux x86_64 and aarch64. On other platforms, pip builds from the sdist, which needs a C compiler.

License

BSD-2-Clause. The vendored cmark-gfm is under its own licenses, in vendor/cmark-gfm/COPYING. vendor/cmark-gfm/UPSTREAM records the upstream commit.

Metadata

Release files for cmark-render 0.2.1

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

Source distribution (sdist)

Source distribution for cmark-render 0.2.1
File Size Uploaded Provenance Actions
cmark_render-0.2.1.tar.gz 143.4 kB With provenance Details for cmark_render-0.2.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for cmark-render 0.2.1
File Interpreter ABI Platform Actions
cmark_render-0.2.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details for cmark_render-0.2.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
cmark_render-0.2.1-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl CPython 3.14 CPython 3.14 Linux glibc 2.28+ ARM64, Linux glibc 2.17+ ARM64 Details for cmark_render-0.2.1-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
cmark_render-0.2.1-cp314-cp314-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 macOS 11.0+ ARM64 Details for cmark_render-0.2.1-cp314-cp314-macosx_11_0_arm64.whl

Total release size: 1.1 MB

Release files / cmark_render-0.2.1.tar.gz

Download URL cmark_render-0.2.1.tar.gz
Size 143.4 kB
Tags Source
SHA-256 checksum
How to use checksums
80c3874d3466e3b6007912cdae5799a52d8b199da84925e98ff5fd69693ca22f
BLAKE2b-256 checksum
How to use checksums
3e9fa0286229281f5b7304db7748c6d34c3c7a73bd9397d3d45a175a08fe6e05
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 12, 2026.

Transparency log

Release files / cmark_render-0.2.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL cmark_render-0.2.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 438.9 kB
Tags CPython 3.14 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
abaf98188ece891b0f9d0eb6f91b54b9a745106c4536985e0dd36727cc1868dd
BLAKE2b-256 checksum
How to use checksums
49eb4675cf1b71c02d731c7f51397d86fca2d0adf38909aae26efc66d46cc89a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 12, 2026.

Transparency log

Release files / cmark_render-0.2.1-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl

Download URL cmark_render-0.2.1-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Size 435.1 kB
Tags CPython 3.14 Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
138f48381ddd98c21e0ff7e052a0d4032250d63e5a168cc2caafe7c9cad1da85
BLAKE2b-256 checksum
How to use checksums
6cfadc167fef8e3b6cc9491bb9167c7cdf33e54ab4d08dd63dc054de2ee669d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 12, 2026.

Transparency log

Release files / cmark_render-0.2.1-cp314-cp314-macosx_11_0_arm64.whl

Download URL cmark_render-0.2.1-cp314-cp314-macosx_11_0_arm64.whl
Size 120.5 kB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
efeffd116be8169b0a35e0e53704bf1915169daff57548c135efab26e463c959
BLAKE2b-256 checksum
How to use checksums
e2a1639f2f4213f3ac42fd1f2915f2afa64723a79175e40073b29a7629a2ca63
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 12, 2026.

Transparency log

Security for cmark-render 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 4 files in this release have been uploaded with provenance metadata.

Select from 4 files

Attestation for cmark_render-0.2.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 12, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.1 This release

4 release files Full provenance

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