-
Notifications
You must be signed in to change notification settings - Fork 94
Description
I recently spent some time modernizing cmarkgfm, and as I spent more time with it, I started asking questions about the underlying cmark-gfm spec, which hasn't seen a released update in over 2 years.
cmarkgfm has been pretty stable, possibly in no small part to the spec also not changing.
In researching some of the reported issues here, as well as in cmarkgfm, and on pypi/warehouse, I've since learned that (this can get confusing, sorry if it seems obvious!):
- GitHub uses a gem named
github-markupto decide which renderer to use to render an input - To render Markdown,
github-markupin turn calls oncommonmarkergem commonmarkerprior to version 1.0.0 wrapped thelibcmarkC library, similar to howcmarkgfm(Python) wrapscmark-gfm(C).commonmarkersince 1.0.0 (December 24, 2023) wraps a Rust cratecomrakinstead.
comrak (Rust) appears to be used by Reddit, docs.rs, crates.io, GitLab as well.
Apparently GitHub has abandoned the effort of trying to maintain their own specification changes to be compatible with the Commonmark spec, as evidenced by the differences on their repo:
and at least one query has not received a reply, as well as another noting the differences in the source vs the published HTML sepc.
This leads me to ask: Should we continue trying to use cmarkgfm Python package and the underlying cmark-gfm C library, or use the same underlying library that GitHub uses?
comrak (Rust) supports the same extensions as cmark-gfm and note their relationship to cmark-gfm. The main comrak contributor also currently appears to work for GitHub, and there a couple other contributors, so it's not a single-maintainer project. And with GitHub using it to render their markdown content, it has a higher probability of continued maintenance and feature-parity.
2025 saw the release of a Python wrapper: https://pypi.org/project/comrak/
Converting the existing use cases to use comrak instead of cmarkgfm is relatively easy, and enables us to explore new features that have landed on services like GitHub.com that our end users have had to find creative workarounds.