From b17bd090c7f4424586d8d2e77bc69138a8f8f47c Mon Sep 17 00:00:00 2001 From: Amethyst Reese Date: Tue, 10 Mar 2026 08:17:59 -0700 Subject: [PATCH] Update docs for Markdown code block formatting --- docs/formatter.md | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/docs/formatter.md b/docs/formatter.md index 2feba07a7e8c1..8ea7d26be446f 100644 --- a/docs/formatter.md +++ b/docs/formatter.md @@ -230,14 +230,10 @@ def f(x): *This feature is currently only available in [preview mode](preview.md#preview).* The Ruff formatter can also format Python code blocks in Markdown files. -In these files, Ruff will format any CommonMark [fenced code blocks][] -with the following info strings: `python`, `py`, `python3`, `py3`, or `pyi`. -Fenced code blocks without an info string are assumed to be Python code examples -and will also be formatted. - -If a code example is recognized and treated as Python, the Ruff formatter will -automatically skip it if the code does not parse as valid Python or if the -reformatted code would produce an invalid Python program. +In these files, Ruff will format any CommonMark [fenced code blocks][] with +the following info strings: `python`, `py`, `python3`, `py3`, or `pyi`. The +formatter will automatically skip a code block if the code does not parse as +valid Python or if the reformatted code would produce an invalid Python program. Code blocks marked as `python`, `py`, `python3`, or `py3` will be formatted with the normal Python code formatting style, while any code blocks marked with