def stashedHTML2text(text, md):
 def _html_sub(m):
  u' Substitute raw html with plain text. '
  try:
   (raw, safe) = md.htmlStash.rawHtmlBlocks[int(m.group(1))]
  except (IndexError, TypeError):
   return m.group(0)
  if (md.safeMode and (not safe)):
   return u''
  return re.sub(u'(<[^>]+>)|(&[\\#a-zA-Z0-9]+;)', u'', raw)
 return HTML_PLACEHOLDER_RE.sub(_html_sub, text)

def stashedHTML2text ( text , md ) : def _html_sub ( m ) : try : ( raw , safe ) = md . htmlStash . rawHtmlBlocks [ int ( m . group ( 1 ) ) ] except ( IndexError , TypeError ) : return m . group ( 0 ) if ( md . safeMode and ( not safe ) ) : return u'' return re . sub ( u'(<[^>]+>)|(&[\\#a-zA-Z0-9]+;)' , u'' , raw ) return HTML_PLACEHOLDER_RE . sub ( _html_sub , text )
extract raw html from stash .