SyntaxHighlighter Evolved Plugin


Here is a plugin that makes it easy for you to display your HTML code on your posts or pages for your readers. It was recommended by wpbeginner.com. They use it themselves. If you are writing php code then just wrap your code in the name of the language you are using with square brackets [ ] instead of angle brackets < >.

Use WordPress’ editor in the Text mode to mark up your code with the square brackets. Don’t use the Visual editor if you don’t want your code mangled. TinyMCE will “clean up” your HTML. Below is a very simple example of the output. I use this plugin in this website.

.myblueclass {
    color: blue;
}

Here is what WPBeginner.com says about this plugin:

It allows us to easily post syntax-highlighted code without losing it’s formatting or making any manual changes. It also allows users to copy the code, or print the code if they like.

The plugin has the option for you to choose the color scheme, display the line numbers, display the toolbar, automatically make URLs clickable, collapse code boxes, show a ruler etc. It has the option, so you can customize the styling as well through additional CSS classes.

For a list of the different types of languages that you can use with this plugin, check out their webpage. In the second column, use the brush aliases.

Brush name Brush aliases File name
ActionScript3 as3, actionscript3 shBrushAS3.js
Bash/shell bash, shell shBrushBash.js
ColdFusion cf, coldfusion shBrushColdFusion.js
C# c-sharp, csharp shBrushCSharp.js
C++ cpp, c shBrushCpp.js
CSS css shBrushCss.js
Delphi delphi, pas, pascal shBrushDelphi.js
Diff diff, patch shBrushDiff.js
Erlang erl, erlang shBrushErlang.js
Groovy groovy shBrushGroovy.js
JavaScript js, jscript, javascript shBrushJScript.js
Java java shBrushJava.js
JavaFX jfx, javafx shBrushJavaFX.js
Perl perl, pl shBrushPerl.js
PHP php shBrushPhp.js
Plain Text plain, text shBrushPlain.js
PowerShell ps, powershell shBrushPowerShell.js
Python py, python shBrushPython.js
Ruby rails, ror, ruby shBrushRuby.js
Scala scala shBrushScala.js
SQL sql shBrushSql.js
Visual Basic vb, vbnet shBrushVb.js
XML xml, xhtml, xslt, html, xhtml shBrushXml.js