Skip to main content

Markdown HTML converters for Python made in Rust

Project description

Markdown HTML converters for Python made in Rust

Exposes two Rust crates which parse markdown to Python using PyO3.

Using Comrak

The first crate exposed is comrak from which we inherited the name:

Example:

  >>> from python_comrak import markdown_to_html
  >>> markdown_to_html("\tfoo\tbaz\t\tbim\n")
  "<pre><code>foo\tbaz\t\tbim\n</code></pre>\n"

markdown_to_html activates the extensions:

Using pulldown-cmark

The second crate is pulldown-cmark. Example:

  >>> from python_comrak import commonmark_to_html
  >>> commonmark_to_html("\tfoo\tbaz\t\tbim\n")
  "<pre><code>foo\tbaz\t\tbim\n</code></pre>\n"

commonmark_to_html activates the extensions:

Notice that pulldown-cmark doesn't implement 100% of CommonMark yet. Also it doesn't have the same set of extensions we use with comrak.

Benchmarks

This implementation is quite simple and doesn't allow much of the underlying crates. The extensions and options are fixed. The following is just a micro-benchmark parsing the text of this README file:

>>> with open('README.md', 'r') as f:
...     contents = f.read()

>>> from python_comrak import markdown_to_html, commonmark_to_html

>>> %timeit markdown_to_html(contents)
54.4 µs ± 1.24 µs per loop (mean ± std. dev. of 7 runs, 10000 loops each)

>>> %timeit commonmark_to_html(contents)
12.5 µs ± 97.3 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

python_comrak-0.8.0-cp312-cp312-manylinux_2_34_x86_64.whl (11.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

python_comrak-0.8.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (13.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

python_comrak-0.8.0-cp311-cp311-manylinux_2_34_x86_64.whl (11.5 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

python_comrak-0.8.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (13.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

python_comrak-0.8.0-cp310-cp310-manylinux_2_34_x86_64.whl (11.5 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

python_comrak-0.8.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (13.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

python_comrak-0.8.0-cp39-cp39-manylinux_2_34_x86_64.whl (11.5 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.34+ x86-64

python_comrak-0.8.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (13.2 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

python_comrak-0.8.0-cp38-cp38-manylinux_2_34_x86_64.whl (11.4 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.34+ x86-64

python_comrak-0.8.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (13.2 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

File details

Details for the file python_comrak-0.8.0-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for python_comrak-0.8.0-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 9ebf56ba35d9df86d7f82a94dcb39dd2852b6451241c62231fd7f7a900da7509
MD5 a2c6c1500a9479c206966fea6f40e2fa
BLAKE2b-256 49e8aaaa639ac3667635e39c8e577fd8ed89271650bf2b0caf2bb97b9dfc103c

See more details on using hashes here.

File details

Details for the file python_comrak-0.8.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for python_comrak-0.8.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a64c899a3aa8fb414c16d5cc04fe3dbb8110699418bce9c5c5117ed154b002bf
MD5 03d4196ff71093aa09902c52d2809054
BLAKE2b-256 2fdac48d7118d305897c0ff330f25ad68ab5d4ac473a217eddb88333228818e6

See more details on using hashes here.

File details

Details for the file python_comrak-0.8.0-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for python_comrak-0.8.0-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 19145ba4af75ecd84bb0b5933032a946a38e84f113bcb0cb3784355cf81c15b6
MD5 72bb7590e81b15d495a2ca57a1e5e3a2
BLAKE2b-256 3ae40234da92bc64dd9c8f553f90521cd7462d04132c621841b73de6c396612f

See more details on using hashes here.

File details

Details for the file python_comrak-0.8.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for python_comrak-0.8.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bcc0ab5e39432b07f47e9c9acfd865a2d8defb53cd7b4ad304b865a862d9b4a9
MD5 d976c2ad0b776a77964cdb205aac114d
BLAKE2b-256 97d77cd00ba98204b24220ac4c183f3f5649bc58da475df48a192af4b186744f

See more details on using hashes here.

File details

Details for the file python_comrak-0.8.0-cp310-cp310-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for python_comrak-0.8.0-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 9569ab5cf9e2b8e52da45b4966e60672ef9dd92d65b8d9297d470e0f0030325a
MD5 1166b7dd4ddc3baa2c61777e631676d2
BLAKE2b-256 cdaee4f24f7df4b8bdca90090dd33e3c8b10f0e26589a2015d555f5c626b890d

See more details on using hashes here.

File details

Details for the file python_comrak-0.8.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for python_comrak-0.8.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 988802e17eef5588ca4f653186bdd6056e57b98188ece5f9121cb1a9a54e13e4
MD5 995122b9814450babc4507ab2bc89fab
BLAKE2b-256 fc6677fcf65dd546afe583356cbaa0d283b01f75c45d33ebc3044cfc0e4b8853

See more details on using hashes here.

File details

Details for the file python_comrak-0.8.0-cp39-cp39-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for python_comrak-0.8.0-cp39-cp39-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 91a9e30240ca45c43f7a39112a24cb5e245e2882067350564eb716903d63bd06
MD5 8354e7963cae15e7124cd4c2a6228f2a
BLAKE2b-256 45f3dc66de31703deca8cec3ef6e0591cd9fc0ba70ee909f63c2839ddd9e0d46

See more details on using hashes here.

File details

Details for the file python_comrak-0.8.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for python_comrak-0.8.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 783b770a1460e6a8379ab57664427a8162b39480b3bb81b32aee453263d4bb63
MD5 e1093d23a3c27260ad48f494d10ad0e7
BLAKE2b-256 686279e2c32f458b69252610ed3a294109e0592c13ecb7484be87213fd1cfa38

See more details on using hashes here.

File details

Details for the file python_comrak-0.8.0-cp38-cp38-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for python_comrak-0.8.0-cp38-cp38-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 f566ad31809b6980b8447659efe5d50992c2c5a2e9b4d550dc8d4ea7e69abeda
MD5 f4c8e8271d6fd8bea1eada642029fc71
BLAKE2b-256 318e93e3bd88369d419edfa99aa5643d3fbf0a6a9c1636483edebb8a7328b055

See more details on using hashes here.

File details

Details for the file python_comrak-0.8.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for python_comrak-0.8.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 59a33a030ac875f926698970d9c148e9a801a29cf8553df4aa44ca4b8368de2e
MD5 8a0a4c9d0ee64c7370b13faff65e4e87
BLAKE2b-256 501464263c7399dc9c3c088a67515e1830cd075d337a079ca5497f35ffe5391c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page