Create a gist now

Instantly share code, notes, and snippets.

@matsen /md-nb-diffs.md forked from iamlemec/nb2md
Last active Dec 26, 2016

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
  • 😊
#!/bin/sh
jupyter nbconvert --to markdown $1 --stdout --log-level=0

this seems to fail with spaces in filenames, right?

@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