https://github.com/lmmx/comrak
Python bindings for the Comrak Rust library, a fast CommonMark/GFM parser
https://github.com/lmmx/comrak
markdown markdown-renderer markdown-to-html
Last synced: 11 months ago
JSON representation
Python bindings for the Comrak Rust library, a fast CommonMark/GFM parser
- Host: GitHub
- URL: https://github.com/lmmx/comrak
- Owner: lmmx
- License: other
- Created: 2025-02-15T03:14:11.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2025-03-24T22:06:45.000Z (11 months ago)
- Last Synced: 2025-03-24T23:20:02.042Z (11 months ago)
- Topics: markdown, markdown-renderer, markdown-to-html
- Language: Rust
- Homepage: https://pypi.org/project/comrak
- Size: 68.4 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-rust-python - comrak - Python bindings for Comrak CommonMark/GFM parser. (📝 Text Processing & Parsing)
README
# comrak
[](https://github.com/astral-sh/uv)
[](https://pdm.fming.dev)
[](https://pypi.org/project/comrak)
[](https://pypi.org/project/comrak)
[](https://pypi.python.org/pypi/comrak)
[](https://results.pre-commit.ci/latest/github/lmmx/comrak/master)
Python bindings for the Comrak Rust library, a fast CommonMark/GFM parser
## Installation
```bash
pip install comrak
```
### Requirements
- Python 3.9+
## Features
Fast Markdown to HTML parser in Rust, shipped for Python via PyO3.
### Options
All options are exposed in a simple manner:
```py
>>> import comrak
>>> opts = comrak.ExtensionOptions()
>>> comrak.render_markdown("foo :smile:", extension_options=opts)
'
foo :smile:
\n'
>>> opts.shortcodes = True
>>> comrak.render_markdown("foo :smile:", extension_options=opts)
'foo 😄
\n'
```
Refer to the [Comrak docs](https://docs.rs/comrak/latest/comrak/struct.Options.html) for all available options.
## Benchmarks
Tested with small (8 lines) and medium (1200 lines) markdown strings
- vs. [markdown](https://pypi.org/project/markdown): 15x faster (S/M)
- vs. [markdown2](https://pypi.org/project/markdown2): 20x (S) - 60x (M) faster
## Contributing
Maintained by [lmmx](https://github.com/lmmx). Contributions welcome!
1. **Issues & Discussions**: Please open a GitHub issue or discussion for bugs, feature requests, or questions.
2. **Pull Requests**: PRs are welcome!
- Install the dev extra (e.g. with [uv](https://docs.astral.sh/uv/): `uv pip install -e .[dev]`)
- Run tests (when available) and include updates to docs or examples if relevant.
- If reporting a bug, please include the version and the error message/traceback if available.
## License
Licensed under the 2-Clause BSD License. See [LICENSE](https://github.com/lmmx/comrak/blob/master/LICENSE) for all the details.