From cbb77da3d7c44045c325ab3213223bcb61a47e40 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Nov 27 2014 15:15:37 +0000 Subject: Hack the markdown decorator to support blockquote marked with ~~~ --- diff --git a/progit/__init__.py b/progit/__init__.py index 328abe4..de59a40 100644 --- a/progit/__init__.py +++ b/progit/__init__.py @@ -367,7 +367,17 @@ def markdown_filter(text): markdown library. """ if text: - return markdown.markdown(text) + # Hack to allow blockquotes to be marked by ~~~ + ntext = [] + indent = False + for line in text.split('\n'): + if line.startswith('~~~'): + indent = not indent + continue + if indent: + line = ' %s' % line + ntext.append(line) + return markdown.markdown('\n'.join(ntext)) return ''