Skip to content

Instantly share code, notes, and snippets.

View gasman's full-sized avatar

Matt Westcott gasman

View GitHub Profile
@gasman
gasman / gfm.py
Created March 6, 2011 00:57 — forked from mvasilkov/gfm.py
import re
from hashlib import md5
def gfm(text):
# Extract pre blocks.
extractions = {}
def pre_extraction_callback(matchobj):
digest = md5(matchobj.group(0).encode('utf-8')).hexdigest()
extractions[digest] = matchobj.group(0)
return "{gfm-extraction-%s}" % digest