kytrinyx/exercism.io — pull request #755 by drueck (2013-09-12 08:34:06+00:00)
Title: Don't treat instance variables in markdown code blocks as mentions

Possible fix for issue #754

For lack of the knowledge of a simpler way and because I did't want to write code to parse markdown code blocks myself, I implemented this by rendering the comment markdown to HTML using the same Markdown processor
that the site uses and then using Nokogiri to strip out any `` or `	` nodes, which are the two ways that the code spans and fenced code blocks are being rendered, respectively. This result is then passed to the existing code that scans for mentions.

A couple of potential downsides to this method are:

1. If the way the markdown processor renders code blocks changes this will no longer work. (However the tests should catch it).

2. This definitely isn't super efficient. If the markdown processor / renderer or nokogiri are slow at all this could be a performance hit. I'm guessing they're fast enough that it's probably not significant, but I haven't benchmarked it.