Jupyter Notebook Convert to Obsidan Vault

little background of why i’m doing this:

I’m working with python script and jupyter notebook a lot, and most of the time, i need to write record and write some report based on what’s inside the notebook. i find it very exhausting that i have to manually copy and paste everything from notebook to my obsidian vault, which where i record literally everything.

I take nbconvert ftw. so here i am.
so, this workflow is based on

  1. my main folder structure in obsidian fault
  2. how nbconvert handles notebook to markdown file, that:
    1. every image in cell output will be exported and located in a new sub-folder regardless of the target directory
    2. the markdown link of the image is not a relative path neither the image name (this is a problem since obsidian recognizes it as a broken link)

The Scriptings (template modification and python script)

i modified nbconvert markdown templates and wrote a python script for little automation.
y’all can find the detail explanation in my github repo:
kelreeeeey/jupyternotebook-to-obsidian-vault: Little project to automate my workflow when working with jupyter notebook and Obsidian (github.com)

here how i use it and the outputs

here, i run this on my terminal in the same directory where my jupyter notebook i want to convert located. you can run it wherever you want as long as you provide a correct path for the input notebook

python converter.py <notebook_name.ipynb> <obsidian_folder_target>

after that, it would look like this:

Jupyter Notebooks in VSC:

Output Markdown:

Output PDF:

I’m planning to…

  1. explore the jinja and nbconvert format
  2. play with jupyter-notebook cell’s tags
  3. read more about jinja thing :pensive: cz im not used to it.
2 Likes