Pygments is Widely Known as Powerful Syntax Highlighter in Python. Here is a ready to use WordPress Pygments Syntax Highlighting Plugin. Those who do not know about Syntax Highlighting, can read this basic article on Syntax Highlighting. There are many ways to detect the programing language and Highlight properly. Those who are not aware about Pygments Syntax Highlighting, can read about it from official website :
Right now, probably the most powerful or usable Syntax Highlighting Plugin in WordPress is Crayon, which we use. But, for more solid code oriented blogs, Pygments is possibly a need.
Pygments Syntax Highlighting in WordPress
Actually Derek Simkowiak wrote the Plugin, but he for some reason has not updated it for more than two years. His blog itself is running WordPress 3.3. There are lot of changes since then, so you can grab and complain from my GitHub Repository :
You need to install python-pygments first (for deb based server) :
sudo apt-get install python-pygments
Then, install this plugin. As written there; the usage pattern is like this :
[pyg language="python" style="monokai" linenos="table" hl_lines="7 8 9" ] code here [/pyg]
GeSHi actually misses line numbers :
# Here is some raw Python, pasted directly into the page:
# For every line...
for line in lines:
# ...print it out if it's not blank:
if line != "":
result = blank_line_handler()
print "Blank line found, handler returned: %s" % result
But with Pygments :
Another example is with mentioning the Theme name :
[pyg language="html+php" style="monokai" ]
Other things are written in the WordPress Pygments repo in details.
Follow the Author of this article :