How to put formatted, highlighted code in a WordPress post

I found two complementary plugins that enable me to put highlighted formatted code in a WordPress page or post. Here’s an example of what they do:

# Plot flux at continuum boundary
pylab.figure()
pylab.hold(True)

pylab.plot(nd_times, Jl_BD, 'b-', label="Flux from BD simulation")
pylab.plot(nd_times, Jl_BD+Jl_BD_std, 'b.', label="Flux from BD simulation")
pylab.plot(nd_times, Jl_BD-Jl_BD_std, 'b.', label="Flux from BD simulation")

Test successful! Note that Javascript must be enabled to see the highlighting. Get the plugins here:

Advertisements

One thought on “How to put formatted, highlighted code in a WordPress post

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s