Skip to main content

Ralsina.Me — Roberto Alsina's website

Some New Stuff in Nikola

I did some quick work on Niko­la (a stat­ic web­site/blog gen­er­a­tor) late­ly, af­ter a long time, and here's what it was:

Multilingual Sitemaps

So, sitemaps are used by Google to in­dex your site. It turns out that they can de­scribe when there are sets of pages that are trans­la­tions of each oth­er. So the next re­lease will do that (Is­sue #1610)

Matplotlib Plots

Mat­plotlib comes with a sphinx ex­ten­sion to do plots So I went and im­ple­ment­ed it, this was Is­sue #1242 and it's a plug­in called py­plot­s, which will be soon at http://­plu­g­in­s.get­niko­la.­com#py­plots

I hat­ed the orig­i­nal code. It felt con­vo­lut­ed, and just weird (it's prob­a­bly just me) so I wrote it from scratch and it has some mi­nor dif­fer­ences, but it's fair­ly com­pat­i­ble.

Classy Images

The do­cu­tils im­age di­rec­tive, for what­ev­er rea­son, does­n't sup­port a class op­tion, so you need to do things like this:

.. class:: foo

.. image:: blah.png

Which is ... not pret­ty. So I did a hacky plug­in that mon­key­patch­es the im­age di­rec­tive to add that op­tion. The plug­in is at http://­plu­g­in­s.get­niko­la.­com/#­classy-im­ages and this fix­es Is­sue 1538

Mediawiki Markup

djbclark point­ed out that there is a li­brary to parse Me­di­aWi­ki from python called sm­c.mw so I im­ple­ment­ed a plug­in to use it, so now you can use Me­di­aWi­ki markup. The plug­in is at http://­plu­g­in­s.get­niko­la.­com/#­me­di­awi­ki

Removed Default Swatch from Bootswatch

This was Is­sue #1656 and now you have to spec­i­fy the swatch. This is a us­abil­i­ty fix, be­cause de­faults mat­ter.

Played with KaTeX

Niko­la sup­ports math us­ing Math­Jax. Math­Jax has some in­ter­est­ing qual­i­ties:

  • It's 160MB of code or so

  • It's not prac­ti­­cal to use with­­out a CDN

  • It's not prac­ti­­cal to use we­bas­set bun­­dles with it

Then, klingt­net men­tioned some­thing called Ka­TeX I had nev­er heard about. I did a quick hacky con­ver­sion to see how it work­s. Not done yet, to­tal­ly ex­per­i­men­tal, but it may be pos­si­ble to bun­dle it, and maybe even have it turned on by de­fault, re­mov­ing the need for the math­jax la­bel which is aw­ful us­abil­i­ty-­wise.

Some of these things are merged, some are still PRs, some are in core, some are plug­ins. They were all pret­ty fun to do :-)


Contents © 2000-2021 Roberto Alsina