Skip to content

Instantly share code, notes, and snippets.

@yinleon
Created March 12, 2021 18:07
Show Gist options
  • Save yinleon/eba1def44422e872f651061df083ac8f to your computer and use it in GitHub Desktop.
Save yinleon/eba1def44422e872f651061df083ac8f to your computer and use it in GitHub Desktop.
Thie code snippet allows you to read the markdown cells in Jupyter notebooks and prints them. This should help when you want to spellcheck and vet the text.
import json
fn = 'notebook.ipynb'
notebook = json.load(open(fn))
notebook.keys()
for cell in notebook['cells']:
if cell['cell_type'] == "markdown":
for sent in cell['source']:
if sent == '\n':
continue
print(sent)
@yinleon
Copy link
Author

yinleon commented Mar 12, 2021

You can copy the output into notion and it'll format it in correct markdown ;)

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