Add mdformat as a pre-commit hook to autoformat Markdown files#50
Add mdformat as a pre-commit hook to autoformat Markdown files#50namurphy wants to merge 1 commit intoheliophysicsPy:mainfrom
Conversation
|
pre-commit.ci autofix |
72e7e40 to
2146ca0
Compare
| - mdformat-gfm | ||
| - mdformat-gfm-alerts |
There was a problem hiding this comment.
gfm refers to GitHub flavored Markdown.
|
@sapols — does this seem reasonable to you? If so, we'd want to apply mdformat to the PHEP PRs that are about to be merged beforehand. Thanks! |
| - mdformat-gfm | ||
| - mdformat-gfm-alerts | ||
| - mdformat-ruff | ||
| language_version: python3.14 |
There was a problem hiding this comment.
I'm a little wary of this; I was unable to run this pre-commit stuff locally because my machine doesn't have 3.14 yet. It seems like the exclude feature only works on Python 3.13+ though so I see why you added it.
|
Thanks @namurphy. Sorry for the super slow response, crazy holiday season. I'm not sure about this one... I personally don't see much benefit. Feels to me like it's solving a problem that didn't exist (I never considered our markdown formatting problematic). In fact, I could see this causing problems where people don't know about these opinionated markdown rules, causing their PRs to have failing checks they might not understand. Sure the checks could be fixed easily enough by commenting |
This PR tests out adding mdformat as a pre-commit hook to apply a consistent formatting to Markdown files. It includes a few extensions to mdformat to account for GitHub flavored Markdown, etc.
I've tentatively excluded PHEP 1, PHEP 2, and
standards.md. If we want to apply these changes to existing PHEPs, we probably want to do it in a separate PR or when we make revisions. Of these, it seems that PHEP 2 would be the one most worth updating since it is the PHEP template.If this PR is accepted, then PHEPs in progress could apply changes by commenting
pre-commit.ci autofixin the conversation tab of their pull request or by runningpre-commit run --all-fileslocally, oruvx pre-commit run --all-filesif uv is installed.By default, mdformat will change numbered lists to all start with
1., so as to minimize diffs. I set the configuration to make these lists numbered instead in case we make the Markdown file the version of record.