def render_markdown(self): start, end = self.editor_buffer.get_bounds() text = self.editor_buffer.get_text(start, end, True) results = self.markdown.render(text) escaped = houdini.escape_js(results) if escaped == None: escaped = houdini.escape_js("\n") self.preview.execute_script("window.App.setHtml('" + escaped + "')")
def addIdea(): text = m.html(h.escape_js(request.form['text']), extensions=m.EXT_AUTOLINK | m.EXT_SPACE_HEADERS | m.HTML_SKIP_HTML | m.HTML_SAFELINK | m.HTML_HARD_WRAP) try: g.db.execute("insert into ideas(userID, title, text, rating) values(?,?,?,?)", (session['ID'], request.form['title'], text, 1)) g.db.commit() except KeyError: return render_template('error.html'), 500 return redirect(url_for('Ideas', user_ID=session['ID']))