dnanhkhoa / nb_black

A simple extension for Jupyter Notebook and Jupyter Lab to beautify Python code automatically using black.
MIT License
367 stars 41 forks source link

Remove trailing semicolons in notebook cells #11

Open czwilling opened 5 years ago

czwilling commented 5 years ago

It seems that black by default deletes trailing semicolons in notebook cells. As these are commonly used to suppress the output of the cells, this can be a bit annoying. Is there any possibility to tell nb_black / black to change this behaviour?

I know that I can just write None in the last line of each python cell but this makes the code kind of ugly.

Thanks in advance and kind regards, Carsten

graingert commented 4 years ago

so black_nb could strip all trailing whitespace and trailing ; before passing the code to black

then add 1 trailing ; if it removed any ;

fingoldo commented 1 year ago

Indeed, I hate when the extension removes the semicolons that I put intentionally to hide garbage output from matplotlib charts. Any solution, please?

MarcoGorelli commented 1 year ago

I don't think this repo is maintained anymore, I'd suggest having a look at https://github.com/n8henrie/jupyter-black