From 38c76266bf9145c00c55b41ef09dc7ac0b1911a5 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Fri, 5 Oct 2012 14:58:38 -0400 Subject: [PATCH] Escape pound sign before running markdown parser. (imported from commit 418f4f76c579b5db9ec7f30cfc92c3f815323756) --- zephyr/models.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/zephyr/models.py b/zephyr/models.py index 7a914da5aa..b47b4ab92f 100644 --- a/zephyr/models.py +++ b/zephyr/models.py @@ -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))