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

Add markdownlint #227

Open
declension opened this issue Aug 27, 2024 · 2 comments
Open

Add markdownlint #227

declension opened this issue Aug 27, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@declension
Copy link

Is your feature request related to a problem? Please describe.

The supplied mdformat is good for a lot of use cases, and if you agree with its strong / unconfiguable opinions, but there are other packages with a lot more flexibility out there.

e.g. https://github.com/DavidAnson/markdownlint

Like Shellcheck, it supports and publishes a lot of configurable rules and can auto-fix many of these.

Describe the solution you'd like

settings.markdownlint.enable = true, I guess. Maybe some thought about how to load .markdownlint.yaml (or equivalent)

Describe alternatives you've considered

The existing MD linter as described

Current workaround
Probably could be improved, but adding this to settings.formatter

    markdownlint = {
      command = "${pkgs.bash}/bin/bash";
      options = [
        "-euc"
        ''
          # Needed to pick up config
          cd ${./.}
          ${pkgs.lib.getExe' pkgs.nodePackages.markdownlint-cli2 "markdownlint-cli2"} --fix $@
        ''
        "--" # bash swallows the second argument when using -c
      ];
      includes = ["*.md"];
    };
@declension declension added the enhancement New feature or request label Aug 27, 2024
@caineblood
Copy link

The above comment asking you to download a file is malware to steal your account; do not under any circumstances download or run it. The post needs to be removed. If you have attempted to run it please have your system cleaned and your account secured immediately.

@zimbatm
Copy link
Member

zimbatm commented Aug 28, 2024

Sounds good, feel free to send a PR.

treefmt executes the formatter with the project root as the current directory, so the wrapper shouldn't be needed. Alternatively, you might want to use the "settings" attribute to generate the config file with nix and pass it with --config-file to the program.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants