From 8c68c5c0111c85b052f0cb6943f1ce6f43bbeb26 Mon Sep 17 00:00:00 2001 From: 34j <55338215+34j@users.noreply.github.com> Date: Wed, 11 Mar 2026 12:48:55 +0900 Subject: [PATCH 1/4] Add `markdown` to `types_or` --- .pre-commit-hooks.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index 4d17023..fde2656 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -3,7 +3,7 @@ description: "Run 'ruff check' for extremely fast Python linting" entry: ruff check --force-exclude language: python - types_or: [python, pyi, jupyter] + types_or: [python, pyi, jupyter, markdown] args: [] require_serial: true additional_dependencies: [] @@ -14,7 +14,7 @@ description: "Run 'ruff format' for extremely fast Python formatting" entry: ruff format --force-exclude language: python - types_or: [python, pyi, jupyter] + types_or: [python, pyi, jupyter, markdown] args: [] require_serial: true additional_dependencies: [] From 9f52a61460d0d6d1fa8526685beed577af723878 Mon Sep 17 00:00:00 2001 From: Brent Westbrook <36778786+ntBre@users.noreply.github.com> Date: Tue, 25 Aug 2026 11:02:54 -0400 Subject: [PATCH 2/4] Update .pre-commit-hooks.yaml --- .pre-commit-hooks.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index fde2656..48bae68 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -3,7 +3,7 @@ description: "Run 'ruff check' for extremely fast Python linting" entry: ruff check --force-exclude language: python - types_or: [python, pyi, jupyter, markdown] + types_or: [python, pyi, jupyter] args: [] require_serial: true additional_dependencies: [] From a2190e262fcfc8ef887d3adebff0c1d7f1aae193 Mon Sep 17 00:00:00 2001 From: Brent Westbrook Date: Tue, 25 Aug 2026 11:10:05 -0400 Subject: [PATCH 3/4] update readme --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a895cae..f694f6f 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,8 @@ repos: - id: ruff-format ``` +The format hook also formats [Python code blocks in Markdown files](https://docs.astral.sh/ruff/formatter/#markdown-code-formatting). + To enable lint fixes, add the `--fix` argument to the lint hook: ```yaml @@ -71,7 +73,7 @@ repos: args: [ --fix ] # Run the formatter. - id: ruff-format - types_or: [ python, pyi ] + types_or: [ python, pyi, markdown ] ``` To lint `pyproject.toml`, add `pyproject` to the list of allowed filetypes (requires `identify>=2.6.18`): @@ -88,7 +90,7 @@ repos: args: [ --fix ] # Run the formatter. - id: ruff-format - types_or: [ python, pyi, jupyter ] + types_or: [ python, pyi, jupyter, markdown ] ``` When running with `--fix`, Ruff's lint hook should be placed _before_ Ruff's formatter hook, and @@ -116,7 +118,7 @@ hooks = [ { id = "ruff-check", args = ["--fix"], types_or = ["python", "pyi"] }, # Run the formatter. - { id = "ruff-format", types_or = ["python", "pyi"] }, + { id = "ruff-format", types_or = ["python", "pyi", "markdown"] }, ] ``` From 620fa17afc8e639829b1fd79f1a58e6fe17e7445 Mon Sep 17 00:00:00 2001 From: Brent Westbrook <36778786+ntBre@users.noreply.github.com> Date: Tue, 25 Aug 2026 11:11:30 -0400 Subject: [PATCH 4/4] Apply suggestion from @ntBre --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f694f6f..18acaa9 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ repos: - id: ruff-format ``` -The format hook also formats [Python code blocks in Markdown files](https://docs.astral.sh/ruff/formatter/#markdown-code-formatting). +By default, the format hook also formats [Python code blocks in Markdown files](https://docs.astral.sh/ruff/formatter/#markdown-code-formatting). To enable lint fixes, add the `--fix` argument to the lint hook: