Skip to content

Instantly share code, notes, and snippets.

@bryanlarsen
bryanlarsen / gfm.rb
Created January 13, 2010 13:18 — forked from mojombo/gfm.rb
require 'digest/md5'
def gfm(text)
# Extract pre blocks
extractions = {}
text.gsub!(%r{<pre>.*?</pre>}m) do |match|
md5 = Digest::MD5.hexdigest(match)
extractions[md5] = match
"{gfm-extraction-#{md5}}"
end