It would be nice if black would also handle Python code blocks in documentation files (reStructuredText, markdown etc).
(via https://github.com/pytest-dev/pytest/issues/3525#issuecomment-394101163)
hah, I had the same idea: https://github.com/ambv/black/issues/292
Heh..
Your issue seems to be a bit broader, and would be possible probably already, given that you could extract code blocks, run black on them and then replace them (kind of an API usage).
What I had in mind would be that black could be just run on documentation files, and would handle all code blocks in there.
Let's wait for some feedback from maintainer(s).
Sounds interesting, it would require a lot more dependencies to be added to Black though to enable parsing Markdown, ReST, and so on. I'll leave this open as I am not opposed to the idea. However, there are more urgent things we need to implement/fix before we can think about this.
I'm going to take a stab at implementing this in a separate project, maybe at some point it could be merged back into core
It lives! https://github.com/asottile/blacken-docs
Here's an example PR of what it can do: https://github.com/pytest-dev/pytest/pull/3528
Most helpful comment
It lives! https://github.com/asottile/blacken-docs
Here's an example PR of what it can do: https://github.com/pytest-dev/pytest/pull/3528