Obsidian Markdown to Jupyter Notebook

I keep all my notes in Obsidian and needed something to create - from time to time - jupyter notebooks out of some of these Obsidian markdown files.

This repository shows you one simple way to do it.

For me Obsidian markdown files are the golden source of truth. Hence in my setup the Jupyter notebooks need to get re-created and overwritten.

I am using a Raku library called Markdown::Grammar which comes with the command line utility from-markdown - you can use that on a per-file basis on the command line.

from-markdown path/to/some-markdown-file.md --to jupyter-obsidian --output /other/path/to/some-markdown-file.ipynb

However, I wanted to convert all markdown files that contain a code block into corresponding Jupyter notebooks, so I use Markdown::Grammar inside a small, custom script that iterates trough all the markdown files in my vault(s).

Maybe Markdown::Grammar or from-markdown could be wrapped in an Obsidian-Plugin, so the user could right-click on files or folders and trigger the markdown-2-jupyter transformation more easily. I never implemented an Obsidian plugin myself … but I definitely would like to use such a “make-my-life-easier” plugin.

I added a daemon mode that watches the input folder for changes and converts new and changed markdown files automatically.

obsidian2ipynb --input-dir /path/to/the/vault --daemon