The problem was that headings with id got escaped by the default formatter of comrak.
# heading {#some-id} -> # heading {\#some-id}
Unfortunately it seems there is no option or other crate that allows easy bi-directional serializing of common mark.
All other options i investigated require an incredible amount of work. (i.e. pulldown-cmark requires wiriting a complete engine, that handle all ast cases and sub node cases)
I fixed that issue now by implementing a custom formatter, that uses comrak::format_commonmark for all nodes except for headings.
The problem was that headings with id got escaped by the default formatter of comrak.
# heading {#some-id}
-># heading {\#some-id}
Unfortunately it seems there is no option or other crate that allows easy bi-directional serializing of common mark.
All other options i investigated require an incredible amount of work. (i.e. pulldown-cmark requires wiriting a complete engine, that handle all ast cases and sub node cases)
I fixed that issue now by implementing a custom formatter, that uses comrak::format_commonmark for all nodes except for headings.
Fixes: https://github.com/NixOS/nixpkgs/pull/303330.