Thursday 3 July 2014

Attempting a new approach to annotating code

My code examples recently have been getting very bloody cluttered with highlighting, so I'm just using this article to experiment with a new approach. I need to test the CSS and JS in a live article, so need to publish something to test it. There is nothing interesting in this article. Don't read it. It's just a scratch pad for me to test my new solution.

Here is a factorial function:

function factorial(required numeric x){
    return x>1 ? x * factorial(--x) : x

  • factorial() function calls itself
  • Each iteration it calls itself, but decrements its value
  • Until it's 1
  • At which point it simply returns itself

So the theory is that the bits I want to talk about are underlined, and when one hovers over them, it cross-references that bit of code with its notes, and highlights both.

This is a work in progress.