GOPHERSPACE.DE - P H O X Y
gophering on zaibatsu.circumlunar.space
Small Victories Count
2020-07-07
by zlg

Today, I wrestled some mistletoe into the cgit installation on my server. Not 
the plant, silly, a CommonMark-compliant parser! [1]

Since the server runs Gentoo, I needed to write an ebuild for mistletoe to get 
it into the system-wide Python path, since Gentoo uses Portage for system-level 
Python and pip for user level... Thankfully my past experience as a contributor 
made this task easy, but any other distro would've let me install mistletoe at 
the system level from pip.

Granted, Portage tracking it means you get correct package handling in terms of 
files, and don't have to rely on pip or the upstream dev uninstalling correctly. 
But, it does make exploring new things in Python land on the server a pain in 
the ass. Digression aside...

My cgit installation now parses Markdown via mistletoe. Visually you won't
notice (much of) a difference, but for me it provides a concrete Markdown style
to adhere to that I can count on to be reasonably available in all flavors of
Markdown. This means my README should, in theory, be renderable (and rendered
more or less the same way) regardless of hosting platform.

I did it the quick and dirty way: copied the existing md2html script from cgit 
upstream and tweaked it to suit mistletoe. Then I copied the about-formatting.sh 
script and replaced its call to md2html with my 'new' renderer, cm2html. Plug 
files into place, update cgitrc, and BANG!

Thirty minutes, one load of stress off my mind after months. It's a small, but 
helpful victory that will help me move onto other issues.

While doing this, I learned I probably should have a repository of files meant
specifically for managing or customizing my server. Then, when I hack config
files I can have a copy in git for later. Doing this would further reduce my
computing stress, so maybe I'll do it this weekend. There's not a whole lot
going on at my server, so it should be easy to put together.

-z

Playing: Zelda: Breath of the Wild
         Monster Hunter World
         Monster Hunter 3 Ultimate

[1]: https://github.com/miyuchina/mistletoe