Replace angle brackets with lt, rt before markdown.

master
Ethan Dalool 2019-05-02 17:30:14 -07:00
parent b5160cb6c4
commit 871a56dd81
1 changed files with 5 additions and 1 deletions

View File

@ -312,7 +312,11 @@ def html_helper_userlink(item):
return link return link
def render_markdown(text): def render_markdown(text):
text = markdown.markdown(text, output_format='html5') # I was going to use html.escape, but then it turns html entities like
#   into   which doesn't work.
# So I only want to escape the brackets.
escaped = text.replace('<', '&lt;').replace('>', '&rt;')
text = markdown.markdown(escaped, output_format='html5')
return text return text
def sanitize_braces(text): def sanitize_braces(text):