How to embed Jupyter Notebooks (.ipynb) into Jekyll (AcademicPages)
Since creating this personal website, I’ve wanted to find a way to embed python notebook snippets to showcase my projects and hopefully eventually create tutorials that people can learn from. To do this, you need to convert python notebook files (.ipynb) into markdown (.md) along with all the embeded images.
- Create a
_notebooks
directory inside the master folder. This is where you should be putting your jupyter notebooks. - Using terminal, navigate to the
_notebooks
directory and type the following command to convert it to markdownjupyter nbconvert <name of file>.ipynb --to markdown
- Move the converted products (which should be the .md file along with a folder containing an image outputs) to
_posts
folder. - Add the Jekyll AcademicPages metadata.
- Add
../
infront of every image path. This will allow the path of the image (which is in the_posts
folder) to be read. Alternatively, you can place the images in the_images
folder but will need to adjust the path accordingly.
There you have it! Pretty simple. Lets you turn your website into an all-in-one repository for all your projects.
Enjoy Reading This Article?
Here are some more articles you might like to read next: