Skip to content

Commit 5fbc4b3

Browse files
committed
Document quarto style, add example for py/pyi style
1 parent 2fc145e commit 5fbc4b3

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

docs/formatter.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,27 @@ reformatted code would produce an invalid Python program.
241241

242242
Code blocks marked as `python`, `py`, `python3`, or `py3` will be formatted with
243243
the normal Python code formatting style, while any code blocks marked with
244-
`pyi` will be formatted like Python type stub files.
244+
`pyi` will be formatted like Python type stub files:
245+
246+
````markdown
247+
```py
248+
print("hello")
249+
```
250+
251+
```pyi
252+
def foo(): ...
253+
def bar(): ...
254+
```
255+
````
256+
257+
Ruff also supports [Quarto](https://quarto.org/) style executable code blocks
258+
with curly braces surrounding the language name:
259+
260+
````markdown
261+
```{python}
262+
print("hello")
263+
```
264+
````
245265

246266
While [formatting suppression](#format-suppression) comments will be handled as
247267
usual within code blocks, the formatter will also skip formatting any code block

0 commit comments

Comments
 (0)