feat: use ruff to format docs code instead of blacken-docs#833
Merged
Conversation
henryiii
force-pushed
the
ruff-016-markdown-docs
branch
from
July 24, 2026 05:12
cc2937c to
ebe1a42
Compare
Ruff 0.16 formats Python code blocks in Markdown, so a single tool covers both code and docs. Drop the blacken-docs hook, bump ruff-pre-commit to v0.16.0, and add markdown to the ruff-format hook's types_or. PC111 now passes with either blacken-docs or a ruff-format hook that lists markdown in types_or. Assisted-by: ClaudeCode:claude-opus-4.8
Assisted-by: ClaudeCode:claude-opus-4.8
henryiii
force-pushed
the
ruff-016-markdown-docs
branch
from
July 24, 2026 05:18
ebe1a42 to
99b32d8
Compare
Ruff's pre-commit hook will format Markdown by default at some point. Pass PC111 unless the ruff-format hook filters Markdown out, instead of requiring a literal `markdown` entry. Assisted-by: ClaudeCode:claude-opus-5
Assisted-by: ClaudeCode:claude-opus-5
Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
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.
I think "markdown" will be added to the hook, in which case this simplifies. See astral-sh/ruff-pre-commit#159.
Close #343.
🤖 AI text below 🤖
Ruff 0.16 can format Python code blocks in Markdown, a stable
blacken-docsreplacement, so one tool now covers both code and docs.blacken-docshook, bumpruff-pre-committov0.16.0, and addmarkdownto theruff-formathook'stypes_or(the hook filters files, so Markdown must be listed).PC111retitled to "Formats code in docs"; it now passes with eitherblacken-docsor aruff-formathook that hasmarkdownintypes_or. Still flags the oldasottile/blacken-docsURL.blacken-docsfor Black users or reStructuredText (which ruff doesn't format); bumped ruff revs tov0.16.0.docs/principles/design.md(a trailing comma).Ruff 0.16 also expands the default rule set, but the guide already recommends an explicit
select, so that change doesn't affect projects following it.📚 Documentation preview 📚: https://scientific-python-cookie--833.org.readthedocs.build/