Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: headings with ids get escaped by comrak #117

Merged
merged 3 commits into from
Apr 15, 2024

Conversation

hsjobeki
Copy link
Collaborator

@hsjobeki hsjobeki commented Apr 11, 2024

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: NixOS/nixpkgs#303330.

src/format.rs Outdated Show resolved Hide resolved
src/format.rs Show resolved Hide resolved
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/2024-04-11-documentation-team-meeting-notes-118/43203/1

@infinisil infinisil merged commit 4326dc7 into nix-community:master Apr 15, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants