Well, the vendor-lock-in effects of Emacs are starting to set in. Since the AsciiDoc support for Emacs is awful, well, my two options were Markdown and org-mode (and maybe reStructuredText). As I've mentioned before, I'm not a huge fan of Markdown, and I've heard great things about org-mode and its integration with Emacs, so I decided to give it a try.

Well, org-mode is great, and I've finally decided that it'd be a good idea to switch to it—thanks to Emacs's first-class support of it. Want to insert a hyperlink? Just SPC m l l. In addition, org-mode has direct PDF, HTML, and other exports with the SPC m e menu (I use Doom Emacs—hence the ergonomic SPC shortcuts). It's really easy. Furthermore, org-mode has an entire ecosystem associated with it, and it seems really powerful. So, I guess I'll be switching to org-mode.

But that posed a question—how do I get org-mode support on blog.ramesh.tv?

Choosing Pandoc over org-ruby

There were two options: I could go about implementing org-mode support with this gem, or I could just add pandoc support. One on hand, pandoc seemed slower, since it'd be spawning a subprocess. On the other hand, pandoc would support many formats at once and provide the same HTML (with the same classes, etc.), so it would be really easy to add pandoc support and just implement all the markup formats at once. But it would be slow.

Initially, I implemented org-mode support with the org-ruby gem, but I eventually changed my mind and decided to go down the pandoc route instead—just for the ease of maintainability. There's a handy gem for this called pandoc-ruby, so I just added that, created a new post class just like I did for AsciiDoc support, and got everything rendered. There was one hurdle, which was parsing the YAML, because I didn't know how to do that, but apparently Ruby's YAML module automatically can find the YAML block inside my org-mode file—which made things very easy.

After this, I wrapped the generated pandoc HTML in another class called pandoc-post, and I just had to implement another set of CSS rules for that pandoc-post class in my SCSS file (just like I did for AsciiDoc support), and I was good to go! Obviously, the blog hasn't implemented styling for 100% of elements you might encounter (eg. checkboxes), but I'll probably do those down the line when I need to add them to a post. Oh, and fun fact: HighlightJS worked automagically with pandoc's rendered HTML, no extra configuration required (which was not the case for org-ruby's generated HTML).

Well, this write-up was quite short, and ostensibly it was just a "test" of the new org-mode capabilities of the blog (this post is written in org-mode), so I'll add some "filler" below.

Other changes

  • It's minor, but the highlight colour of text on any post will now match the accent colour of the light/dark theme you're using instead of being the bog-standard default colour of your browser.
  • HighlightJS's version was bumped up, and while I'm not sure it makes a difference at all, I guess it's good to be on the latest version.

Future additions

  • I might be switching out the post (but none of the other fonts) font for a serif font, as I've wanted to have a serif on the website for a while but I haven't found one satisfactory enough—but I think I've found one that'll fit the bill, so you might see this change soon.
  • I'll probably be doing a write up on my experience with NixOS in my homelab soon, but it'll probably end up being quite long, so I might split this future post into multiple posts.
  • ¡Posiblemente verá más en español!