jml's notebook

Sidenotes support

Sidenotes support

I’ve finally got around to implementing sidenotes support for this blogThis is an example of a sidenote..

My first approach was to copy and paste footnotes extension that comes with markdown, and then modify it to suit. Unfortunately, this reached a dead end fairly quickly. I found the module to complex to be able to pare it down to what I needed.

In particular, the extension has a strangely complex way of dealing with multiple references to the same footnote. This isn’t a feature that I intend to use, and even if I do, I’d implement it quite differently.

So, in the end, I started a new extension that’s heavily inspired by the original, re-using it’s Markdown syntax parsers for identifying sidenote definitions and replacing sidenote references.

It could probably be made nicer, but it works enough for now. I haven’t implemented margin notes, as I can’t be bothered thinking of a Markdown syntax for them, and I have no real desire for them anyway.

One nice side effect of this change is that it fixes the problem where footnote links weren’t working on the main index page. There aren’t links any more, so they can’t link to the wrong place.

If you want to use this sidenotes extension, be sure to add a counter-reset: sidenote-counter to your h2 styles.