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: shift headings with commonmark AST #115

Merged
merged 2 commits into from
Apr 9, 2024

Conversation

hsjobeki
Copy link
Collaborator

@hsjobeki hsjobeki commented Mar 29, 2024

This PR fixes the issue, that the current headings are shifted line wise without taking the context into account.

Leading to issues that shift single line comments in code blocks # comment because they look the same as # heading

We should use a real commonmark library because code blocks have multiple variants and can also be nested. I am also not sure if there are any other edge cases where a line starts with # and not beeing headings. Any regex or other self-cooked algoritms are not desireable due to complexity and maintenance overhead.

Nobody noticed this issue yet; i guess. But as we progress with the migration it is rather ugly and should be fixed by now.

closes #113

Done:

  • Bump fix version
  • Add/change unit tests

src/format.rs Outdated Show resolved Hide resolved
src/format.rs Outdated Show resolved Hide resolved
src/format.rs Outdated Show resolved Hide resolved
src/format.rs Outdated Show resolved Hide resolved
@infinisil
Copy link
Collaborator

(needs a rebase)

Copy link
Collaborator

@infinisil infinisil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good to me now, thanks!

@infinisil infinisil merged commit ff2d5fd into nix-community:master Apr 9, 2024
2 checks passed
@infinisil
Copy link
Collaborator

This seems to have broken the Nixpkgs manual build: NixOS/nixpkgs#302990 (comment)

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.

Bug: Code comments are shifted as they where headings
2 participants