Describe the bug
As of black==25.11.0 but not in black==25.9.0, it's removing extra code comments.
To Reproduce
Run black a.py on the below:
# %% [markdown]
# fmt: off
# fmt: on
It overzealously removes the top comment, leaving just:
Expected behavior
black to not remove the header comments, as they're part of Jupytext's percent format.
Environment
- Black's version: 25.11.0 (and current
main branch at black==25.11.1.dev3+gf209c53a0)
- OS: macOS 15.6.1, build version 24G90
- Python version: Python 3.13.5 (main, Jul 10 2025, 15:26:00) [Clang 17.0.0 (clang-1700.0.13.5)]
Additional context
Coming from mwouts/jupytext#1467 (comment)
Describe the bug
As of
black==25.11.0but not inblack==25.9.0, it's removing extra code comments.To Reproduce
Run
black a.pyon the below:It overzealously removes the top comment, leaving just:
Expected behavior
blackto not remove the header comments, as they're part of Jupytext'spercentformat.Environment
mainbranch atblack==25.11.1.dev3+gf209c53a0)Additional context
Coming from mwouts/jupytext#1467 (comment)