Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion ipynb/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ def code_from_ipynb(nb, markdown=False):
for cell in nb['cells']:
if cell['cell_type'] == 'code':
# transform the input to executable Python
code += ''.join(cell['source'])
# skip cells that start with %% because they might not even contain Python code
if len(cell['source']) > 0 and len(cell['source'][0]) >= 2 and cell['source'][0][:2] != '%%':
code += ''.join(cell['source'])
if cell['cell_type'] == 'markdown':
code += '\n# ' + '# '.join(cell['source'])
# We want a blank newline after each cell's output.
Expand Down