Skip to content

Instantly share code, notes, and snippets.

@matsen matsen/ forked from iamlemec/nb2md
Last active Oct 28, 2019

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 commented Dec 10, 2016

this seems to fail with spaces in filenames, right?


This comment has been minimized.

Copy link

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
You can’t perform that action at this time.