Syntax Highlighting
Implement syntax highlighting using highlight.js. This is the simplest method for implementing syntax highlighting. Consider moving the line numbering into Ruby code instead of handling it through JavaScript.
Line numbers are not supported by highlight.js. This is hacked in through
JavaScript. At page load, the number of new line characters are counted in the
code element. Then, JavaScript loops through and adds a number and line break
to an empty div that is floated left. This gives the appearence of line
numbers.
$document().ready is only called when the DOM completes loading. Since
turbolinks loads new data into the DOM without completely reloading, the ready
event is never fired. We can account for this by using the page:load event.