csurfer / blackcellmagic

IPython magic command to format python code in cell using black.
MIT License
306 stars 13 forks source link

%%black will not format cell with magic in it #5

Open mborus opened 6 years ago

mborus commented 6 years ago

When formatting cells with magic in it, like

  [...]
  import matplotlib.pyplot as plt
  import seaborn as sns
  import pandas as pd
  %matplotlib inline

the %%black magic returns the error cannot parse: 12:0 %matplotlib inline

This happens with any line that has a % sign to indicate magic.

MarvinT commented 5 years ago

Here's an alternative solution that solves this issue: https://gist.github.com/MarvinT/a072aa992e977496974aaf492287b08c and https://marvint.github.io/Black-Jupyter/