diff options
Diffstat (limited to 'markdown/extensions/fenced_code.py')
-rw-r--r-- | markdown/extensions/fenced_code.py | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/markdown/extensions/fenced_code.py b/markdown/extensions/fenced_code.py index 3592d78..e5b3350 100644 --- a/markdown/extensions/fenced_code.py +++ b/markdown/extensions/fenced_code.py @@ -15,13 +15,17 @@ This extension adds Fenced Code Blocks to Python-Markdown. ... ~~~ ... ''' >>> html = markdown.markdown(text, extensions=['fenced_code']) - >>> html - u'<p>A paragraph before a fenced code block:</p>\\n<pre><code>Fenced code block\\n</code></pre>' + >>> print html + <p>A paragraph before a fenced code block:</p> + <pre><code>Fenced code block + </code></pre> Works with safe_mode also (we check this because we are using the HtmlStash): - >>> markdown.markdown(text, extensions=['fenced_code'], safe_mode='replace') - u'<p>A paragraph before a fenced code block:</p>\\n<pre><code>Fenced code block\\n</code></pre>' + >>> print markdown.markdown(text, extensions=['fenced_code'], safe_mode='replace') + <p>A paragraph before a fenced code block:</p> + <pre><code>Fenced code block + </code></pre> Include tilde's in a code block and wrap with blank lines: @@ -29,23 +33,21 @@ Include tilde's in a code block and wrap with blank lines: ... ~~~~~~~~ ... ... ~~~~ - ... ... ~~~~~~~~''' - >>> markdown.markdown(text, extensions=['fenced_code']) - u'<pre><code>\\n~~~~\\n\\n</code></pre>' + >>> print markdown.markdown(text, extensions=['fenced_code']) + <pre><code> + ~~~~ + </code></pre> -Multiple blocks and language tags: +Language tags: >>> text = ''' ... ~~~~{.python} - ... block one - ... ~~~~ - ... - ... ~~~~.html - ... <p>block two</p> + ... # Some python code ... ~~~~''' - >>> markdown.markdown(text, extensions=['fenced_code']) - u'<pre><code class="python">block one\\n</code></pre>\\n\\n<pre><code class="html"><p>block two</p>\\n</code></pre>' + >>> print markdown.markdown(text, extensions=['fenced_code']) + <pre><code class="python"># Some python code + </code></pre> Copyright 2007-2008 [Waylan Limberg](http://achinghead.com/). |