from creoleparser import text2html """ text can be creole-encoded, see http://www.wikicreole.org/imageServlet?page=CheatSheet%2Fcreole_cheat_sheet.png&width=340 """ def creole2html(text): # creoleparser returns an utf-8 encoded string by default, but this would cause "Markup" below to fail during decoding. # The parameter "None" for "encoding" forces unicode output. This works with "Markup". # Replace single backslashes with double ones (new line for creole), since python # interprets a double backslash as the escape sequenze of a single backslash. text = text.replace("\\", "\\\\") return text2html(text, encoding=None)