#28930·ruff

Known Deviations doc incorrect for multiline-strings

Author: cdunklauCreated Sep 27, 2026Updated Sep 28, 2026
Labelsdocumentation

Summary

The "Call expressions with a single multiline string argument" example on the website seems to claim that Black does bad things to the content of multiline string literals. As of September 26th, 2026, it looks like that comes from here. It says:

Unlike Black, Ruff preserves the indentation of a single multiline-string argument in a call expression:

python
# Input
call(
  """"
  A multiline
  string
  """
)

dedent(""""
    A multiline
    string
""")

# Black
call(
  """"
  A multiline
  string
  """
)

dedent(
  """"
  A multiline
  string
"""
)


# Ruff
call(
  """"
  A multiline
  string
  """
)

dedent(""""
    A multiline
    string
""")

The wording and the example make it look like Black changes the indentation within the string, which would be a big screwup... but it doesn't, and couldn't in normal mode because that would be an AST change, and Black explicitly checks for those. I checked against Black versions 22.12.0, 23.12.1, 24.10.0, 25.12.0, and 26.5.1, none of them changed the indentation within the string itself.

I chased it down to the v0.3.0 release, which included that content into crates/ruff_python_formatter/README.md, from where it ultimately wound up in docs/formatter/black.md.

The output of (those versions of) Black 22 through 25 looks like:

python
# Black 22.12.0, 23.12.1, 24.10.0, 25.12.0
call(
    """"
  A multiline
  string
  """
)

dedent(
    """"
    A multiline
    string
"""
)

...which is a bit wonky, to be sure. That was the issue covered by PR 9637 which made it into Ruff 0.3.0.

Black 26 hugs the quotes better:

python
# Black 26.5.1
call(""""
  A multiline
  string
  """)

dedent(""""
    A multiline
    string
""")

Not quite the same as Ruff, so I think it still belongs in the Known Deviations doc.

Also, Ruff gives me this...

python
# Ruff 0.16.9
call(
    """"
  A multiline
  string
  """
)

dedent(""""
    A multiline
    string
""")

Note the opening quotes for call() are indented 4 spaces, not 2, so that's also different than the example in the Known Deviations doc.

Please update the docs to resolve those inconsistencies. Maybe it's worth it to check this kind of thing in CI?

Version

No response