Replace angle brackets with lt, rt before markdown.
This commit is contained in:
parent
b5160cb6c4
commit
871a56dd81
1 changed files with 5 additions and 1 deletions
|
@ -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('<', '<').replace('>', '&rt;')
|
||||||
|
text = markdown.markdown(escaped, output_format='html5')
|
||||||
return text
|
return text
|
||||||
|
|
||||||
def sanitize_braces(text):
|
def sanitize_braces(text):
|
||||||
|
|
Loading…
Reference in a new issue