aboutsummaryrefslogtreecommitdiffstats
path: root/markdown/extensions
diff options
context:
space:
mode:
authorDaniel Gottlieb <danny.gottlieb@gmail.com>2011-12-27 16:21:39 -0500
committerDaniel Gottlieb <danny.gottlieb@gmail.com>2011-12-27 16:21:39 -0500
commit2a8550ea467e1534d525e1220716b8a5281028c1 (patch)
tree225c39d2771721eb2477619d61db0b48e409b32f /markdown/extensions
parent2e3830b9bf3a0829db7a5d04f731b5019d28cc65 (diff)
downloadmarkdown-2a8550ea467e1534d525e1220716b8a5281028c1.tar.gz
markdown-2a8550ea467e1534d525e1220716b8a5281028c1.tar.bz2
markdown-2a8550ea467e1534d525e1220716b8a5281028c1.zip
Allow tildes or backticks in the fenced_code extension to support the syntax used by github
Diffstat (limited to 'markdown/extensions')
-rw-r--r--markdown/extensions/fenced_code.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/markdown/extensions/fenced_code.py b/markdown/extensions/fenced_code.py
index e5b3350..87cdfc8 100644
--- a/markdown/extensions/fenced_code.py
+++ b/markdown/extensions/fenced_code.py
@@ -49,6 +49,8 @@ Language tags:
<pre><code class="python"># Some python code
</code></pre>
+Optionally backticks instead of tildes as per how github's code block markdown is identified.
+
Copyright 2007-2008 [Waylan Limberg](http://achinghead.com/).
Project website: <http://www.freewisdom.org/project/python-markdown/Fenced__Code__Blocks>
@@ -69,7 +71,7 @@ from markdown.extensions.codehilite import CodeHilite, CodeHiliteExtension
# Global vars
FENCED_BLOCK_RE = re.compile( \
- r'(?P<fence>^~{3,})[ ]*(\{?\.(?P<lang>[a-zA-Z0-9_-]*)\}?)?[ ]*\n(?P<code>.*?)(?P=fence)[ ]*$',
+ r'(?P<fence>^(?:~{3,}|`{3,}))[ ]*(\{?\.(?P<lang>[a-zA-Z0-9_-]*)\}?)?[ ]*\n(?P<code>.*?)(?P=fence)[ ]*$',
re.MULTILINE|re.DOTALL
)
CODE_WRAP = '<pre><code%s>%s</code></pre>'