As I plan to post a lot of code to my blog, in particular Python code, I wanted to find the best way of displaying code snippets with full syntax highlighting.
After some investigations I quickly worked out that the SyntaxHighlighter Evolved plugin from Alex Mills was the way to go. To get this, download the plugin from the wp-admin console and activate. Then to embed some code in your post simply wrap your source code in a “python” shortcode tag. e.g.
[python]code goes here....[/python]
[php]code goes here....[/php]
Example – Highlighted Python Code
x = 1 if x == 1: # if x==1 then print msg print("Hello World")
0 Comments