Skip to content

Instantly share code, notes, and snippets.

@ruslanmv
Last active May 13, 2024 08:17
Show Gist options
  • Save ruslanmv/74f09769d18b244909158712a341ff6f to your computer and use it in GitHub Desktop.
Save ruslanmv/74f09769d18b244909158712a341ff6f to your computer and use it in GitHub Desktop.
Saving the Notebook to markdown
pip install "notebook<7"
### Saving the Notebook to markdown
import IPython
#from IPython.lib import kernel
from ipykernel.kernelbase import Kernel
%%javascript
var kernel = IPython.notebook.kernel;
var thename = window.document.getElementById("notebook_name").innerHTML;
var command = "theNotebook = " + "'"+thename+"'";
kernel.execute(command);
import os
command_convert="jupyter nbconvert "
command_in=theNotebook+".ipynb"
command_out=theNotebook+".md"
command_action=" --to markdown --output "
command=command_convert+command_in+command_action+command_out
print(command)
os.system(command)
@ruslanmv
Copy link
Author

adding version

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