I’m going to try blogging my experiments with deep learning. I want to make this easy so I need to be able to publish Jupyter Notebooks.
I want to publish the notebooks because that is how I investigate deep learning models and techniques. Making blogging easy makes it more likely I am going to stick with it.
So I need to be able to publish notebooks easily.
Gitlab CI
I have had a look and I am going to use Gitlab Pages to publish my blog. This is because I can use Gitlab CI to update the blog whenver I push a new commit.
What I now need is a way to generate a static site for Gitlab Pages.
Static Site
I can use hugo as a very easy static site generator. It can publish any markdown file as a post. Markdown is very easy to use.
Hugo also provides a way to serve the site with automatic refresh when files change. That way I can check that the site looks good.
Now I need a way to convert notebooks to markdown.
Markdown Converter
Jupyter itself can convert notebooks to markdown.
The nbconvert
command can output to a variety of formats, including markdown:
jupyter nbconvert --to markdown --output OUTPUT_PATH NOTEBOOK_PATH
Finally I want a way to update the markdown whenever the notebook changes - that way the hugo server will pick up the changes.
entr
I was going to use inotifytools for this, but the syntax for that is a bit unweildy. It turns out that this is a shared opinion and someone wrote entr
to handle file changes.
So I can use that to watch for new or updated notebook files, and then trigger the build.
Easy.
Math
The final thing to check is that I can write latex expressions in case I am feeling fancy.
\[ \sum_i 3 \cdot x_i \]
After switching to the beautifulhugo theme it has started working. I was going to follow the instructions on this post but it’s not needed after all.