fastai / nbdev

Create delightful software with Jupyter Notebooks
https://nbdev.fast.ai/
Apache License 2.0
4.88k stars 488 forks source link

Cleaning carriage return breaks code in cells #427

Closed jcozar87 closed 3 years ago

jcozar87 commented 3 years ago

Hi,

I detected a weird behaviour when cleaning my notebooks using the nbdev_clean_nbs: a cell in Markdown which contains some latex formula $A \rightarrow B$ is turned into $A \nightarrow B$. I read the code in nbdev/clean.py, line 69 that \r\n is replaced by \n.

Before I make a PR I want to understand the purpose of that piece of code. I understand that this is done to unify the line breaks for both Windows and MacOS/Linux OS. However, is there a real problem if that replacement is not applied?

Thank you very much!

GilesStrong commented 3 years ago

Hi, also get this error where my LaTeX gets altered during cleaning. In my case r"Profiled $\Delta\left(-L\right)$" gets changed to r"Profiled $\Delta\left(-L\night)$". Since the CI for nbdev template repos checks for differences caused by running nbdev_clean_nbs, I don't think that cleaning should be doing any changes, otherwise the check will always fail, since the Git hooks don't appear to do the replacement.

hamelsmu commented 3 years ago

This is a duplicate of #422 cc: @muellerzr @jph00

I'm closing this in favor of that