def safemarkdown(text):
 from markdown import markdown
 if text:
  text = text.replace('<', '&lt;')
  text = r_url.sub('<\\1>', text)
  text = markdown(text)
  return text

def safemarkdown ( text ) : from markdown import markdown if text : text = text . replace ( '<' , '&lt;' ) text = r_url . sub ( '<\\1>' , text ) text = markdown ( text ) return text
converts text to html following the rules of markdown .