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 but one at a time, because cmark-gfm keeps a global table of special characters that changes during each parse. 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.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 cmark-render 0.2.0
File Size Uploaded Provenance Actions
cmark_render-0.2.0.tar.gz 143.3 kB With provenance Details for cmark_render-0.2.0.tar.gz

Built distributions (wheels)

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

Total release size: 1.1 MB

Release files / cmark_render-0.2.0.tar.gz

Download URL cmark_render-0.2.0.tar.gz
Size 143.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e87449078796788c350734f887fbc251f3e8ce1a06f37dfbc41563acf070ce87
BLAKE2b-256 checksum
How to use checksums
e53b09001ea20618a98857f3ba9ed0f4a0c372fab2894f1de1a9868d8228949a
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.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL cmark_render-0.2.0-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
8ef204267e21f23b143cb42389c3154c5bb8c15f3c559e989003d3d86dea6a0d
BLAKE2b-256 checksum
How to use checksums
b05a038fb69a0c1190f5d1bac1b963cbb567ed0f782bf89ab4191da19f1e29e5
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.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl

Download URL cmark_render-0.2.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Size 435.2 kB
Tags CPython 3.14 Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
dfd9855dcb2600c664e32393ffa307218c585ebe1c6b52a2ebd52a51062c5c7e
BLAKE2b-256 checksum
How to use checksums
03302cc4c0cb4edd60d7a878e768115ef764034d58ec7b04f16626e74ba2a08e
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.0-cp314-cp314-macosx_11_0_arm64.whl

Download URL cmark_render-0.2.0-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
2db564c6296c9702d5b634f4f7a903f7d537a4a106934ccf6377cac75fc270fe
BLAKE2b-256 checksum
How to use checksums
02252e4f860a549faa9560852aa6130bbb2a7aa95afec11b5734af9b6e0f6dff
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.0

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