Skip to content

Instantly share code, notes, and snippets.



Forked from iamlemec/nb2md
Last active Feb 22, 2021
What would you like to do?
Markdown diffs for jupyter notebooks.

For sane jupyter notebook diffs

  • Install the nbconvert package, though you probably already have it if you are using jupyter.
  • Put the nb2md script below in your path and make executable
  • Add the following to your .gitattributes file, which can be in your home directory (use nb2md for all projects) or in the root of your project:
*.ipynb diff=nb2md
  • Run
git config --global diff.nb2md.textconv nb2md

to use nb2md for all projects, or add the following to your project's .git/config

[diff "nb2md"]
        textconv = nb2md
  • 😊
jupyter nbconvert --to markdown $1 --stdout --log-level=0

This comment has been minimized.

Copy link

@michaelaye michaelaye commented Dec 10, 2016

this seems to fail with spaces in filenames, right?


This comment has been minimized.

Copy link

@apinstein apinstein commented Dec 26, 2016

@michaelaye yes it fails with spaces in filenames, if you do "$1" instead, it works perfectly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment