When you find yourself in a new place that you intend to stay at for some time, you usually want to personalize it a bit.. Some time may be needed for making the big changes, so that you don't overdo it, but there are always a few itches that you just have to scratch!

For Ghost, when starting a code-centric blog, one of those is syntax highlighting. Luckily, others before me have solved this problem; in particular, Peter Timofejew wrote a blog post about how to solve it without modifying your theme:

Of the two syntax highlighting options, highlight.js has Elixir support according to the docs. Problem is, the CDN-hosted highlight.js.min doesn't include Elixir!

To fix that, we can add languages/elixir.min.js as well, and upgrade to highlight.js 8.6 at the same time, ending up with the following in our Blog Header injection:

<!-- -->  
<link rel="stylesheet" href="//">  
<script src="//"></script>
<script src="//"></script>
  pre {
    word-wrap: normal;
    -moz-hyphens: none;
    -ms-hyphens: none;
    -webkit-hyphens: none;
    hyphens: none;
    font-size: 0.7em;
    line-height: 1.3em;
    pre code, pre tt {
    white-space: pre;

Now, I can get my Elixir code[^1] a bit more readable:

defmodule Everex.Util do
  require Record

  defmacro __using__(_options) do
    quote do
      require Record
      require Everex.Util
      import Everex.Util, only: [deftype: 3]

  def record_to_struct(the_record, fields, struct_name) do
    [_tag | values] = the_record |> Tuple.to_list
    do_record_to_struct(values, fields, struct(struct_name))

  defp do_record_to_struct([], [], acc), do: acc
  # value is record; convert to struct
  defp do_record_to_struct([value|vt], [{key,:undefined}|dt], acc)
  when Record.is_record(value)
    acc = struct(acc,[{key, Everex.Types.to_struct(value)}])
    do_record_to_struct(vt, dt, acc)
  # value is list; process and convert contents to structs if needed
  defp do_record_to_struct([value|vt], [{key,[]}|dt], acc) do
    value = r2s_process_list(value, [])
    do_record_to_struct(vt, dt, struct(acc,[{key, value}]))
  # it's just a regular type, update struct key with the value
  defp do_record_to_struct([value|vt], [{key,:undefined}|dt], acc) do
    do_record_to_struct(vt, dt, struct(acc,[{key, value}]))

  # ...


[^1]: Code extract from Everex, my Evernote API client for Elixir (