Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: []
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ repos:
- id: ruff-format
```

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:

```yaml
Expand Down Expand Up @@ -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`):
Expand All @@ -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
Expand Down Expand Up @@ -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"] },
]
```

Expand Down