We'll create fresh WordPress site with WPygments installed. You have 20 minutes to test the plugin after that site we'll be deleted.
Server side syntax highlighter based on Pygments highlighter software.
To use this plugin you need pygments in your server:
sudo apt-get install python-setuptools
easy_install Pygments
That’s all. Now you can download the plugin and install it in your WordPress.
Once you get installed the plugin the usage is straightforward. just enclose your code between tokens named with the corresponding lang:
[javascript]....[/javascript]
[php]....[/php]
See “Languages and filetypes supported” section to know available languages.
Tokens support a few parameters (all optionals):
[php **style**="manni" **linenumbers**="table"]....[/php]
style="manni" defines code styling. Currently are 22 available styles.<br>
Default styling is default
wich is very nice, but maybe you like other styles. see “Color styles” section.
If you set “linenumbers” to inline
or table
, the line numbers will be added as independent table column or as part of the line.
`
[javascript]
//comment line
var foo = “foo”;
var bar = function(){
var baz;
}
[/javascript]
`
Outputs highlighted js with default style, and no line numbers.
`
[javascript style=”monokai” linenumbers=”inline”]
//comment line
var foo = “foo”;
var bar = function(){
var baz;
}
[/javascript]
`
Outputs highlighted js with monokai style with line numbers (as part of the line).
`
[javascript style=”monokai” linenumbers=”table”]
//comment line
var foo = “foo”;
var bar = function(){
var baz;
}
[/javascript]
`
Outputs highlighted js with monokai style with line numbers (as new column).
These are supported color styles:
monokai
manni
rrt
perldoc
borland
colorful
default
murphy
vs
trac
tango
fruity
autumn
bw
emacs
vim
pastie
friendly
native
Pygments not only highlights languages. also highlights filetypes like .conf Nginx configuration file, Apache (filenames .htaccess, apache.conf, apache2.conf), etc.
NOTE: to use see “Usage” section
important sdsd;
General
apacheconf
: (.htaccess, apache.conf, apache2.conf)bash
, sh
, ksh
:ini
, cfg
: (*.ini, *.cfg)makefile
:nginx
:yaml
:perl
:vb.net
:console
:Javascript
javascript
: Pure Javascriptcoffeescript
: Pure CoffeeScriptjson
: Pure JSONPHP
cssphp
: PHP embedded in CSShtmlphp
: PHP embedded in HTMLjsphp
: PHP embedded in JSphp
: Pure PHPxmlphp
: PHP embedded in XMLRuby
ruby
, duby
: Ruby (*.rb, *.rbw, *.rake, *.gemspec, *.rbx, *.duby)csserb
, cssruby
: Ruby embedded in CSSxmlerb
, xmlruby
: Ruby embedded in XMLCSS and CSS compilers
css
:sass
:scss
:HTML and HTML template systems
html
:haml
:jade
:SQL
sql
:sqlite3
:mysql
:Python, jinja & Django
python
: Pure Pythonpython3
: Pure Python 3 xmldjango
, xmljinja
: Django/Jinja embedded in XMLcssdjango
, cssjinja
: Django/Jinja embedded in CSSdjango
, jinja
: Pure Django/Jinja htmldjango
, htmljinja
: Django/Jinja embedded in HTMLjsdjango
, jsjinja
: Django/Jinja embedded in JavascriptJava && family
java
:clojure
:groovy
:jsp
:C, C++, Objetive-c, C Sharp
cobjdump
: c-objdump (*.c-objdump)c
: C (*.c, *.h, *.idc)cpp
: C++ (*.cpp, *.hpp, *.c++, *.h++, *.cc, *.hh, *.cxx, *.hxx)csharp
: C# (*.cs)objectivec
: (*.m)XML
xml
: (*.xml, *.xsl, *.rss, *.xslt, *.xsd, *.wsdl)xslt
: (*.xsl, *.xslt)