Repository navigation
chore: make every markdown file mdformat-clean - #299
Merged
Merged
Conversation
The mdformat hook only runs on files a push actually touches, so this debt surfaced one file at a time, always while someone was trying to do something else. #298 and #240 both had to reach for --no-verify. This clears all 18 remaining files so the hook stops being a tripwire. Purely presentational: prose rewrapped to 80 columns, table separators padded, ordered lists normalized to lazy `1.` numbering (which renders identically), and `---` thematic breaks rewritten as `___`. Nine of the eighteen are the user-facing help pages, which are rendered in the app, so they got extra checks rather than a bulk pass: - Every `<pre>` and `<textarea>` block is byte-identical before and after, verified by extracting and comparing them programmatically. Those are the whitespace-significant regions, and there are 34 of them across the help pages. - The help pages are Jinja-rendered (`render_template_string` in application.py), so `{{ rustfava_version }}` in `_index.md` is a live substitution rather than literal text. Placeholder counts match before and after in every file, and the one placeholder is unchanged. - Prose changes are soft line breaks only, which CommonMark collapses to spaces — including the lines wrapping `<kbd>` and link spans. Checked content preservation across all 18 by diffing token streams before and after: the only differences are ordered-list markers and table pipes. No prose word changed. 671 passed. mdformat is now idempotent repo-wide, so pushes no longer need --no-verify for this.
The previous commit broke `mkdocs build --strict`, which CI caught:
ERROR - mkdocstrings: rustfava.core options: show_submodules: true
could not be found
ERROR - Could not collect 'rustfava.core options: show_submodules: true'
Aborted with a BuildError!
docs/api.md carries two indentation-significant mkdocs constructs that
mdformat does not understand — a `!!! note` admonition and an
mkdocstrings `::: rustfava.core` block with an indented `options:`
mapping. Reflowing joins their indented bodies onto the marker line, so
the identifier becomes `rustfava.core options: show_submodules: true`
and collection fails.
Restored the file and excluded it from the hook, rather than adding an
mdformat mkdocs plugin, so the wrap behaviour of every other file is
unchanged.
My verification on the previous commit was not good enough and is worth
recording. I compared token multisets before and after, which is why I
claimed nothing but list markers and table pipes moved — but that check
is blind to this failure by construction: every token is still present,
merely rearranged across lines. It caught nothing because there was
nothing to catch at the token level. The `<pre>`/`<textarea>` check was
the right shape but the wrong scope; the same reasoning should have been
applied to any embedded whitespace-significant syntax, not just HTML.
Now verified end to end: `mkdocs build --strict` exits 0 with the file
restored, and exits 1 with three ERROR lines when the mangled version is
put back, so the check demonstrably distinguishes the two.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
mdformathook only runs on files a push actually touches, so this debt surfaced one file at a time — always while someone was trying to do something else. #298 and #240 both had to reach for--no-verify. This clears all 18 remaining files so the hook stops being a tripwire.Purely presentational: prose rewrapped to 80 columns, table separators padded, ordered lists normalized to lazy
1.numbering (renders identically),---thematic breaks rewritten as___.The nine help pages got extra scrutiny
These render in the app, so I didn't want to bulk-apply and hope:
<pre>and<textarea>block is byte-identical before and after — verified by extracting and comparing them programmatically, not by eye. Those are the whitespace-significant regions, and there are 34 across the help pages.application.pypasses the rendered markdown throughrender_template_string(html, rustfava_version=...), so{{ rustfava_version }}in_index.mdis a live substitution, not literal text. Placeholder counts match before and after in every file, and the one placeholder is unchanged.<kbd>and link spans.Content preservation
Checked across all 18 by diffing token streams before and after. The only differences are ordered-list markers (
2.→1.) and table pipes from separator padding. No prose word changed.Verification
671 passed, 1 skippedmdformat --all-filesnow Passes — idempotent repo-wide--no-verify, which is the point: the pre-push hook ran and passed on its ownWorth noting the other half of that tripwire is already gone — #240 fixed
update-flake-sources.ymlfor prettier, so pre-push is now clean for both hooks.