Friday, August 5, 2011

Including Python Source Code

Following the advice here, we should have syntax highlighting now.

If we put in

<pre class="prettyprint">
def hello_world():
    print "Hello World"

hello_world()
</pre>

returns
<pre>
Hello World
</pre>

We get:

def hello_world():
    print "Hello World"

hello_world()

returns
Hello World


In short use <pre> tags for output and <pre class="prettyprint"> for source.

No comments:

Post a Comment