Open adamchainz opened 3 years ago
if you want to make it work and maintain it sure
The tricky part here is dealing with IPython magics, such as %%timeit
, which aren't valid Python syntax
Just bringing up black
's IPython magic handler, in case it's useful https://github.com/psf/black/blob/main/src/black/handle_ipynb_magics.py (perhaps it's even possible to do this reusing black.format_cell
?)
This may be somewhat redundant, since IPython has the ability to run Black on input lines during execution. It doesn't help with reformatting existing shell sessions but it covers creating them.
I tend to use IPython shell examples rather than the plain Python console, and I'd like blacken-docs to format them, e.g.
Would this be an accepted feature? Happy to give it a shot if so.