Skip to content

Commit e4c52d6

Browse files
34jntBre
andauthored
Add markdown to types_or (#159)
## Summary Now `*.md` files are in `tool.ruff.include` by default and may be used with `tool.ruff.format.preview = True`, etc. https://docs.astral.sh/ruff/settings/#include astral-sh/ruff@4795eca#diff-959aaaf28345388cb476e91b1a8b127625bffba0ca2f8ed794f687bd27e50302 ## Test Plan ```yaml - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.15.5 hooks: - id: ruff-format types_or: [python, pyi, jupyter, markdown] ``` --------- Co-authored-by: Brent Westbrook <[email protected]>
1 parent e602328 commit e4c52d6

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

‎.pre-commit-hooks.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
description: "Run 'ruff format' for extremely fast Python formatting"
1515
entry: ruff format --force-exclude
1616
language: python
17-
types_or: [python, pyi, jupyter]
17+
types_or: [python, pyi, jupyter, markdown]
1818
args: []
1919
require_serial: true
2020
additional_dependencies: []

‎README.md‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ repos:
2828
- id: ruff-format
2929
```
3030
31+
By default, the format hook also formats [Python code blocks in Markdown files](https://docs.astral.sh/ruff/formatter/#markdown-code-formatting).
32+
3133
To enable lint fixes, add the `--fix` argument to the lint hook:
3234

3335
```yaml
@@ -71,7 +73,7 @@ repos:
7173
args: [ --fix ]
7274
# Run the formatter.
7375
- id: ruff-format
74-
types_or: [ python, pyi ]
76+
types_or: [ python, pyi, markdown ]
7577
```
7678

7779
To lint `pyproject.toml`, add `pyproject` to the list of allowed filetypes (requires `identify>=2.6.18`):
@@ -88,7 +90,7 @@ repos:
8890
args: [ --fix ]
8991
# Run the formatter.
9092
- id: ruff-format
91-
types_or: [ python, pyi, jupyter ]
93+
types_or: [ python, pyi, jupyter, markdown ]
9294
```
9395

9496
When running with `--fix`, Ruff's lint hook should be placed _before_ Ruff's formatter hook, and
@@ -116,7 +118,7 @@ hooks = [
116118
{ id = "ruff-check", args = ["--fix"], types_or = ["python", "pyi"] },
117119
118120
# Run the formatter.
119-
{ id = "ruff-format", types_or = ["python", "pyi"] },
121+
{ id = "ruff-format", types_or = ["python", "pyi", "markdown"] },
120122
]
121123
```
122124

0 commit comments

Comments
 (0)