Typesetting Maths, Pretty Syntax Highlighting
So, the Wordpress import went OK - using exitwp. It was not perfect, but I fixed up the problems in the top 10 posts in analytics (annoyingly most of my traffic goes to this old post about measuring IOPS in Linux)
Some of my posts had used $\LaTeX$ to typeset mathematics so I wanted to fix that up and found these instructions
I can do inline $\LaTeX$ like $e^{i\pi} + 1 = 0$ and blocks like
$$ \imath\hbar\frac{\partial}{\partial t}\Phi (x, t) = \hat{H}\Phi (x, t) $$
Pretty nice, the only downside is switching to kramdown has stopped the triple backtick code block filter from working.
Now I didnt particularly like the syntax highlighting and stumbled
across
Gorgeous Octopress Codeblocks with CodeRay,
which looked nice and also required kramdown (so maybe it’s a good
idea…). I am not good at frontend stuff and have not looked into how
exactly all the filters etc work but am not quite happy using the
{%coderay %}
filter for codeblocks in place of the triple backticks,
somehow liquid just feels less nice in a markup that’s supposed to be
human-readable.
(ns euler55
(:require [clojure.string :as string]))
(defn palendrome? [s]
(= s
(string/reverse s)))
(defn is-lychrel?
([n] (is-lychrel? n 0))
([n depth]
(let [numstring (str n)]
(cond (and (> depth 0)
(palendrome? numstring))
false
(> depth 50)
true
:else
(recur (+ n
(bigint (reverse-string numstring)))
(inc depth))))))
(println (count (filter is-lychrel? (range 10001))))
Again, pretty nice. I may try and extend the formatting to the gist embeds and get the triple backtick thing to use CodeRay.