Plug the Python syntax highlighter Pygments into
WordPress to turn every <pre><code>
into highlighted code server-side,
no JavaScript required!
Originally created by @wellingguzman, this repo was a fork.
MIT license and continuation of the plugin with permission.
You can read the tutorial here http://davidwalsh.name/pygments-php-wordpress, not on how to use it, but how @wellingguzman wrote it.
- Copy
WP-Pygments
into your plugins directory in WordPress - Head to
wp-admin/plugins.php
and activateWP Pygments
- Now every
<pre><code>
you have in your post/page content would turn into pygments highlighted code
Ex:
<pre class="php">
<code>
<?php
function hello( $name ) {
return 'Hello, ' . $name;
}
echo hello( 'Mundo' );
?>
</code>
</pre>