diff --git a/files/helpers/markdown.py b/files/helpers/markdown.py
index 4e504805ca..341ad89083 100644
--- a/files/helpers/markdown.py
+++ b/files/helpers/markdown.py
@@ -18,7 +18,7 @@ class SubMention(SpanToken):
pattern = re.compile("(^|\s|\n)(r/|/r/)(\w{3,25})")
parse_inner = False
def __init__(self, match_obj):
- self.target = match_obj.group(3)
+ self.target = (match_obj.group(1), match_obj.group(3))
class RedditorMention(SpanToken):
@@ -45,8 +45,9 @@ class CustomRenderer(HTMLRenderer):
return f'''{space}
@{user.username}'''
def render_sub_mention(self, token):
- target = token.target
- return f'r/{target}'
+ space = token.target[0]
+ target = token.target[1]
+ return f'{space}r/{target}'
def render_redditor_mention(self, token):
space = token.target[0]