Escape pound sign before running markdown parser.

(imported from commit 418f4f76c579b5db9ec7f30cfc92c3f815323756)
This commit is contained in:
Tim Abbott
2012-10-05 14:58:38 -04:00
parent 9cfa8a868f
commit 38c76266bf

View File

@@ -216,7 +216,10 @@ class Message(models.Model):
url = match.group('url')
return ' [%s](%s) ' % (url, url)
with_links = self.link_regex.sub(linkify, self.content)
# Escape the # (pound sign) to avoid markdown making them into
# (giant) headers.
content = self.content.replace("#", "#")
with_links = self.link_regex.sub(linkify, content)
return md_engine.convert(with_links)
@cache_with_key(lambda self, apply_markdown: 'message_dict:%d:%d' % (self.id, apply_markdown))