-
Notifications
You must be signed in to change notification settings - Fork 20
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
Lint Markdown with pre-commit hook #700
Comments
Good idea, assuming the lint rules are sensible.
Is there not a tool that would auto apply lint rules to cleanup old posts? I imagine much of it could be done relatively easy with some find/replace once identified, I did similar when we first setup lint in FLAMEGPU2. |
I've found some of the rules to be a bit aggressive but its possible to configure which you use.
|
Closes #700 Adds [pre-commit](https://pre-commit.com) to the repository (and configures but doesn't yet enable [pre-commit.ci](https://pre-commit.ci)). Some basic `pre-commit` hooks are included but the meat of the linting is done via [markdownlint-cli2](https://github.com/DavidAnson/markdownlint-cli2) which is configured via `.markdownlint-cli2.yaml`. Retrospective linting of the `.md` and `.sh` files included in this PR has been undertaken (mostly line-length issues, but a typo has been corrected in `_posts/2022-12-22-git-blame.md` too). `README.md` has a new section on setting up and using `pre-commit` for this work and includes details of why retrospective linting has not been applied more widely (basically I didn't want to break any pages) and how to ignore revisions should anyone wish to undertake this task. `markdownlint-cli2` does have an option to `fix: true` which will where possible fix things automatically, but I had a go at doing this and it wasn't applying things very well (e.g. line lengths weren't being sorted). I have written a short script ([`wrap`](https://gitlab.com/nshephard/dotfiles/-/blob/master/bin/wrap)) that uses `fmt` to sensibly wrap lines for all files of a particular type at a specified length (and in parallel too) if anyone wanted to have a go at sorting things out. One thing to discuss would be whether we enable [pre-commit.ci](https://pre-commit.ci/). I didn't want to foist this upon people without consensus being reached.
Continuing my drive to get everyone hooked on pre-commit I was wondering how people would feel about having the markdownlint-cli2 pre-commit hook in place and in the CI pipeline (via pre-commit.ci) to lint our Markdown when we post new articles.
I wouldn't propose going back through the older posts as that would take some considerable time!
The text was updated successfully, but these errors were encountered: