a great toolset for static blogging

by on
3 minute read

I've considered switching from Jekyll to some other static blogging solution for quite a while. My main motivator was that I disliked to touch Ruby tooling for this purpose and other minor details regarding speed of previewing as the site grows, etc.

So, once I came to know of Hugo, I got interesting in it. It's just a simple binary!, readily available from AUR (I'm an ArchLinux user), built upon Go.

And after reading some comparisons I got hooked.

At the time I learned about Hugo I didn't have enough incentive to switch, since I had my blog on GitHub Pages just by posting Markdown files there without having to post a build of the site (leveraging GitHub's native Jekyll support). I had to build the blog just for local previewing, hence I wished to avoid this getting slower over time. I also wished instant previewing too, just like Hugo offers.

Enter GitLab Pages, which allows you to choose your blogging engine! Once I've seen this from GitLab on my tweet stream I thought it was time for another try.

GitLab Pages supports Hugo hosting (and many others) just like GitHub supports Jekyll, they support custom domains and it's really simple to setup. This blog sources are hosted at https://gitlab.com/oblitum/nosubstance.me.

There was just one additional caveat with moving to Hugo, I needed to make sure that Markdown parsing options would be good enough to embed math. Jekyll supports Kramdown, which is a Markdown superset that's friendly to MathJax and the like. Many other parsers have issues with Markdown containing LaTeX content.

Hugo has a tutorial about setting up MathJax, but there's a much easier route than what's described there. Being technical, I checked exactly what parsers do Hugo supports and learned that it supports a Markdown superset known as Mmark.

Mmark is a great Markdown dialect which I started to adopt, it works with Hugo out of the box, you just need to name your files *.mmark. It's MathJax friendly and Pandoc syntax works OK for it in Vim.

As a last improvement, I've taken opportunity to also switch from MathJax to \(\KaTeX\). It was very simple to setup my Hugo theme for it, which allows me to write stuff like the following using simple LaTeX:

\[R_{\mu\nu} - \frac{1}{2}g_{\mu\nu}R = \frac{8\pi G}{c^4}T_{\mu\nu}\]

And it should cost much less for rendering. With \(\KaTeX\) there's even the option to have more localized DOM scanning, but for now I've just enabled it globally. It's faster, but it's not as exact at rendering as MathJax, and also support less LaTeX as it's more equation focused.

gitlab, hugo, gohugo, mmark, markdown, katex, mathjax, latex, math, blogging
Spotted a mistake in this article? Why not suggest an edit!