SyntaxHighlighter Plus is a Wordpress plugin for code syntax highlighting. It is an enhanced version of the original SyntaxHighlighter by Matt, Viper007Bond and mdawaffe. Please give them a big applause for making such a great plugin!
SyntaxHighlighter allows you to easily post syntax highlighted code all without loosing it's formatting or making an manual changes.
It supports the following languages (the alias for use in the post is listed next to the name):
- Bash --
bash
, sh
- C++ --
cpp
, c
, c++
- C# --
c#
, c-sharp
, csharp
- CSS --
css
- Delphi --
delphi
, pascal
- Diff --
diff
- Groovy --
groovy
- Java --
java
- JavaScript --
js
, jscript
, javascript
- Perl --
perl
, pl
- PHP --
php
- Plain text --
plain
, text
- Python --
py
, python
- Ruby --
rb
, ruby
, rails
, ror
- Scala --
scala
- SQL --
sql
- VB --
vb
, vb.net
- XML/HTML --
xml
, html
, xhtml
, xslt
This plugin uses the
SyntaxHighlighter JavaScript package by Alex Gorbatchev.
Updgrading From A Previous Version
To upgrade from a previous version of this plugin, delete the entire folder and files from the previous version of the plugin and then follow the installation instructions below.
- Starting from Wordpress 2.7, plugin upgrades are handled by Wordpress, there is no need to manually upload files.
Important: If you have made any changes to the CSS file, please make sure to back it up before upgrade!
Uploading The Plugin
Extract all files from the ZIP file, making sure to keep the file structure intact, and then upload it to
/wp-content/plugins/
.
This should result in the following file structure:
- wp-content - plugins - syntaxhighlighter-plus | readme.txt | syntaxhighlighter.php - syntaxhighlighter - scripts | clipboard.swf | shBrushBash.js | shBrushCpp.js | shBrushCSharp.js | [...] | shCore.js | shLegacy.js - src | shCore.js | shLegacy.js - styles | SyntaxHighlighter.css
See Also: "Installing Plugins" article on the WP Codex
Plugin Activation
Go to the admin area of your WordPress install and click on the "Plugins" menu. Click on "Activate" for the "SyntaxHighlighter" plugin.
Plugin Usage
Just wrap your code in
[sourcecode language='css']code here[/sourcecode]
. The language attribute is
required! See the
plugin's description for a list of valid language attributes.