[Utils] Markdown helpers escape special chars (#2182)

Escaping italics (`*`) that get passed to `italics()` doesn't work, the string still won't show up properly.
This commit is contained in:
Twentysix 2018-10-06 02:14:11 +02:00 committed by Toby Harradine
parent fdf3f86ab0
commit 03892f5ef1

View File

@ -67,6 +67,7 @@ def bold(text: str) -> str:
The marked up text. The marked up text.
""" """
text = escape(text, formatting=True)
return "**{}**".format(text) return "**{}**".format(text)
@ -104,6 +105,9 @@ def inline(text: str) -> str:
The marked up text. The marked up text.
""" """
if "`" in text:
return "``{}``".format(text)
else:
return "`{}`".format(text) return "`{}`".format(text)
@ -121,6 +125,7 @@ def italics(text: str) -> str:
The marked up text. The marked up text.
""" """
text = escape(text, formatting=True)
return "*{}*".format(text) return "*{}*".format(text)
@ -276,6 +281,7 @@ def strikethrough(text: str) -> str:
The marked up text. The marked up text.
""" """
text = escape(text, formatting=True)
return "~~{}~~".format(text) return "~~{}~~".format(text)
@ -293,6 +299,7 @@ def underline(text: str) -> str:
The marked up text. The marked up text.
""" """
text = escape(text, formatting=True)
return "__{}__".format(text) return "__{}__".format(text)