Fluid tag for displaying GitHub Gists with noscript tags in a Jekyll post
A couple of mostly minor notes and improvements:

return "" unless @text =~ /([\d]*) (.*)/
gist, file = $1.strip, $2.strip


I generally try to avoid magic variables where ever possible. Using match and the resulting MatchData object tends to be less error prone.



code       = code.gsub "&lt;", "&amp;lt;"


Is there a reason you only escape &lt; characters? Unless I'm missing something, it seems preferable to use CGI.escapeHTML instead.



return string


It seems inconsistent to me that in some methods you have a return statement on the last line and in others you do not. I would always leave out the return statement on the last line as it is unnecessary.



return nil if @cache == false


It is pretty unidiomatic to use == with boolean literals - usually one would just negate the boolean instead of comparing to false. if !@cache or better unless @cache will read more natural to most people than if @cache == false.



File.new(file).read


You should never use File.new without storing its return value somewhere and then later calling close on it. As a matter of fact in most cases you should not use File.new at all, but rather File.open with a block, which closes the file automatically when the block's end is reached. The way you're doing it the file handle will remain open until the File object is garbage collected, which may be a while. This is a bad practice and can lead to subtle problems.

However in this case you don't even need File.open as there is already a method which does exactly what you need: File.read(file).



gist.gsub! /[^a-zA-Z0-9\-_\.]/, ''


You don't need to escape . as it has no special meaning inside brackets.



cache_gist(gist, file, data) unless @cache == false


This would really be a lot more readable without the explicit comparison and the double negation:

cache_gist(gist, file, data) if @cache