Sunday, July 06, 2014

A whole blog post (with highlighted source code snippet) in org-mode

This is a test to see if I can write a blog post in org-mode, output the whole thing to HTML and then have it look half decent in my Blogger blog.

Here is some Clojure source:
(defn my-function [message]
  (println "The message is: " message))
I turn the org-mode source into HTML by hitting C-c C-e (to execute org-export) and then I hit H to put the resulting export into a new buffer. It's then easy to copy the contents into Blogger's raw HTML view.

The result doesn't look completely terrible to my eyes. If you don't like the light blue background for the source code then I'm afraid that I must take credit for having chosen that but the good bits were output by htmlize. To be honest, though, I'm not sure what this setup currently buys me, over and above editing the text in Blogger's editor and then using htmlize to output each snippet of source code separately and then copying it into its own <pre> block.

All of this raises the question of why I am still using Blogger in this day and age. To be honest, it's more a matter of inertia than anything else. I'd really like to get round to trying to use something like Jekyll (which seems very cool) or Wordpress (which everyone else seems to have been using since the year dot) but Blogger is what I have been using, on and off, since 2006 and it seems to work relatively well, despite being rather annoying and despite being closed source and a wee bit dumbed down. Thankfully, Blogger does let me customise pretty much all of the HTML and CSS that it spews out and it will have to do until I find the time to properly learn (and migrate to) something else.

No comments: