Skip to content
karlcow edited this page Dec 3, 2011 · 4 revisions

pyshell extra

The pyshell extra allows one to have a Python interactive shell session (as identified by the >>> prompt) be interpreted as an indented <pre>-block without having to indent it. For example, this text:

This is how you can determine your operating system in Python:

>>> import sys
>>> sys.platform
'darwin'

becomes this:

<p>This is how you can determine your operating system in Python:</p>

<pre><code>
>>> import sys
>>> sys.platform
'darwin'
</code></pre>

command-line usage

$ python markdown2.py -x pyshell FOO.txt

module usage

>>> markdown2.markdown(text, extras=["pyshell"])

(Return to Extras page.)