Syntax Highlighter Wordpress Plugin

Easily highlight syntax!

Contents

Overview

This is a wordpress syntax highlighting plugin. It is simple and probably one of the best syntax highlighters in the market. This plugin integrates Alex Gorbatchev’s Syntax Highlighter Tool : Alex’s Site. Full Support for :

  • Bash/shell
  • C#
  • C++
  • CSS
  • Delphi
  • Diff
  • Groovy
  • JavaScript
  • Java
  • Perl
  • PHP
  • Plain Text
  • Python
  • Ruby
  • Scala
  • SQL
  • Visual Basic
  • XML

Download

Download and unzip in your wp-content/plugins Wordpress folder:

ZIP: Syntax Highlighter and Code Prettiffier Wordpress Plugin

Usage

Just surround your code like this:

<pre class="brush:[code-alias]"> …Your Code Here </pre>

replace the "[code-alias]" segment with the type of code you have. See all the available brush aliases. For Example, PHP would be like this:

<pre class="brush:php"> …Your PHP Code Here </pre>

Examples

C#

// Hello1.cs
public class Hello1
{
   public static void Main()
   {
      System.Console.WriteLine("Hello, World!");
   }
}

Java

class Dog
{
  public Dog(String aType)
  {
     System.out.println("I am a Dog");
  }
}
public class MainClass
{
  public static void main(String[] a)
  {
    Dog d = new Dog("a");
    Class objectType = d.getClass();
    System.out.println(objectType.getName());
  }
}

Bash / Shell

/usr/bin/svnadmin hotcopy /path/to/svn/repository /path/to/destination
2.
3.tar cvf /path/to/backup/svnbackup-`date +%Y-%m-%d`.tar /path/to/destination/*
4.
5./usr/local/bin/7z a -tbzip2 -v2g svnbackup-`date +%Y-%m-%d`.tar.bz2 /path/to/backup/svnbackup-`date +%Y-%m-%d`.tar

More Details

The Syntax Highlighter Plugin has more configurable options. Go to = http://alexgorbatchev.com/wiki/SyntaxHighlighter

65 Responses to “Syntax Highlighter Wordpress Plugin”

  1. Syntax Highlighter and Code Prettifier Plugin for Wordpress : The Last Engine on April 27th, 2009 3:39 pm

    [...] created a wordpress plugin to highlight syntax using the latest 2.0 SyntaxHighlighter by Alex Gorbatchev. It supports Bash/shell, C#, C++, CSS, [...]

  2. Kudo on May 5th, 2009 3:23 am

    Excellent!

  3. Kudo on May 5th, 2009 3:25 am

    But It make the time to load page is too low! So merge all shBush js file to one to load faster

  4. Syntax Highligheter at skardal.com on May 23rd, 2009 3:25 am

    [...] http://www.lastengine.com/syntax-highlighter-wordpress-plugin/ « Spark – an alternative view engine App Arch Guide 2.0 » [...]

  5. Gabrov blogja » Hasznos Wordpess pluginok on June 25th, 2009 10:04 am

    [...] egy nagyon jó forráskód kiemelőt Wordpresshez. Syntax Highlighter and Code Colorizer for Wordpress [...]

  6. Syntax Highlighter Wordpress Plugin : The Last Engine | WordPress News - New WordPress Themes on June 27th, 2009 12:20 pm

    [...] original post here: Syntax Highlighter Wordpress Plugin : The Last Engine Share and [...]

  7. Jon on June 29th, 2009 12:34 pm

    Wonderful plugin! Perfect for my needs.

    Do you have any future plans to have a “copy code” button so users can just click once and the code is copied to their clipboards?

  8. Vijesh on June 29th, 2009 3:26 pm

    The code is directly from Alex Gorbatchev’s Syntax Highlighter. If he updates his end with the copy button, I’ll integrate that into Wordpress.

  9. Highlight Codes In Your Posts With Beautiful Syntax Highlighter Wordpress Plugin | TricksDaddy on July 10th, 2009 11:01 am

    [...] are lots of plugins available for wordpress blogs to highlight codes in your posts but I will use syntax highlighter plugin by Vijesh Mehta in this [...]

  10. Macky99 on July 15th, 2009 4:57 am

    This is a really nice plugin. Useful for everyone.

  11. Highlight Codes in Your Posts with Syntax Highlighter Wordpress Plugin | Blogging Tips by TeraTips.com on July 15th, 2009 6:50 am

    [...] are lots of plugins available for wordpress blogs to highlight codes in your posts but I found this syntax highlighter plugin by Vijesh Mehta is beautiful and [...]

  12. Syntax Highlighter and Code Prettifier Plugin for WordPress | Nuss... E agora?!? on July 18th, 2009 12:22 pm

    [...] Por fim, caso alguém queira testá-lo, o site é http://www.lastengine.com/syntax-highlighter-wordpress-plugin [...]

  13. Need a blog software that doesn’t suck | Shlrm.org Blag on August 4th, 2009 6:32 am

    [...] Found this. That makes the code not suck. Pasting code into this thing is still a PAIN, as it doesn’t [...]

  14. Tim on August 20th, 2009 9:42 pm

    I’m having some problems with bash code. I’m using > to redirect output to a file, but on the page this shows up as “>”. Replacing “>” with “>” in the source doesn’t help. Has anybody run into this?

  15. Tim on August 20th, 2009 9:42 pm

    Ugh. So the source has >, and the display is &gt;.

  16. Syntax Highlighter : Plugin Untuk Mempercantik Tampilan Kode Program | wirautama.net on August 21st, 2009 10:28 am

    [...] plugin Syntax Highlighter ini saya dapatkan disini, silahkan download lalu install seperti menginstall plugin wordpress pada umumnya. Untuk cara [...]

  17. tony on August 22nd, 2009 3:51 pm

    it is the best code highlighter ever. works like a charm.

    i tried so many plug-ins but nothing works like this one.

    unfortunately , i tried to make it work as bbcode like [php][/[php], but i got no luck, it always crashes.

    is there any trick to work around this?

  18. Syntax Highlighting and Printing « Paul Binindas Blog on August 25th, 2009 12:37 pm

    [...] installed a WordPress plugin for syntax highlighting of code blocks today. The plugin I installed uses JavaScript to do the highlighting and has a additional view source and print buttons, which is [...]

  19. Syntax Highlighter Wordpress Plugin « Cieloazul Weblog on September 2nd, 2009 6:42 pm

    [...] Highlighter Wordpress Pluginをいれてみた。 詳しくは、ここ。 9月 3rd, 2009 | Category: [...]

  20. Jacky on September 14th, 2009 6:28 am

    Great Job!
    I like it very much!
    Thank you very much!

  21. Jeremy on September 14th, 2009 6:32 pm

    I am having a problem with the php brush. For some reason the code is looking like it was ran through htmlspecialchars(). When using “‘. and .’” I get “&27 any ideas?

  22. FixOutlook mosaic avatar finder | Bits of Thought and Bytes of Code - Vincent van Scherpenseel on September 15th, 2009 12:14 am

    [...] PS: This great syntax highlighting is done using the Syntax Highlighter Wordpress plugin. [...]

  23. Philip M. Hofer (Frumph) on September 19th, 2009 4:41 am

    ^^ wordpress when saving the post always removes the class=”brush:php” anyway around that?

  24. admin on September 19th, 2009 10:02 am

    Not that I know of yet.

  25. syntax highlighter evolved | Random Thoughts of a Technology Enthusiast | Vinod Pandey on September 19th, 2009 2:17 pm

    [...] list of languages supported by worpdress plugin syntax highlighter [...]

  26. Neotech on September 19th, 2009 7:50 pm

    I guess for Javascript brushes not worked.

  27. Marc on September 22nd, 2009 10:56 am

    When I use this plugin in Wordpress 2.8.4, it strips the class attribute off the pre tag. Any ideas?

  28. SoN9ne on September 28th, 2009 7:11 am

    I am having a problem with this plugin replacing “‘. with “%27. when viewing it. This has made the usage of this plugin useless for me. Any help to fix this would be appreciated, I just odn’t have the time to debug this myself anytime soon.

    Thanks to any who can help.

    An example of code being used to cause this is:
    echo ‘‘.”\n”;

  29. Confluence: Team Redaktion, QS, Support, Training on October 9th, 2009 4:37 am

    Release-Note-Tool…

    Plugins Suche Multiple Category Selection Widget…

  30. 5 plugins pour afficher du code dans Wordpress « Armel Pingault on October 12th, 2009 6:55 am

    [...] Syntax Highlighter and Code Prettifier [...]

  31. Gabriel A. Zorrilla on October 12th, 2009 12:25 pm

    The plugin is not working on 2.8, any tips?

  32. Gabriel A. Zorrilla on October 12th, 2009 3:09 pm

    Found a solution, make SURE that the header.php of your templates includes this:

    Thanks to:

    http://thecssbug.com/syntaxhighlighter-plus-problem

  33. jp.ikekou.Blog » Blog Archive » WordPressのSyntaxHighlighterがActionScriptに対応してました。 on October 23rd, 2009 3:18 am

    [...] Syntax Highlighter and Code Colorizer for Wordpress こちらもSyntaxHighlighterのバージョンが古かったので、却下。 [...]

  34. Oliver Mezquita on October 23rd, 2009 10:33 am

    This is the plugin I was looking for! Took me ages to find it. Thanks!

  35. The best code/syntax highlighter plugin for wordpress blogs | HonkBlog|TechNotes on October 24th, 2009 10:14 am

    [...] best code/syntax highlighter plugin for wordpress blogs that I could find is one called the “Syntax Highlighter and Code Colorizer for Wordpress” by a guy called Vijesh Mehta.  All I can say Vijesh is that you [...]

  36. Wordpress Plugin SyntaxHL-Editor officially released | MacLovin on October 25th, 2009 9:52 am

    [...] offers an easy to use graphical user interface for Syntax Highlighter and Code Colorizer for Wordpress. You can easily enter and modify source-code highlighted in your posts as well as specify options [...]

  37. SyntaxHL Editor on October 27th, 2009 1:45 am

    [...] Editor Plugins von , verfügt TinyMCE über ein grafisches User Interface für den  Syntax Highlighteruand Code Colorizer für Wordpress. Man kann Sourcecode eingeben und dann in Postings einfügen. Share and [...]

  38. WordPress Plugin Releases for 10/28 « Weblog Tools Collection on October 28th, 2009 2:17 pm

    [...] an easy to use graphical user interface for Syntax Highlighter and Code Colorizer for Wordpress. You can easily enter and modify source-code highlighted in your posts as well as specify options [...]

  39. Post Pic Plugins WordPress 28-10-2009 on October 29th, 2009 8:32 am

    [...] un fácil utilizar el interfaz gráfico de usuario para el Resaltador de sintaxis y el Código Colorizer para Wordpress. Usted puede entrar y modificar el código fuente de relieve en sus mensajes, así como especificar [...]

  40. Syntax Highlighter Wordpress Plugin on November 2nd, 2009 6:24 am

    [...] can install this plugin by looking for “Syntax Highlighter and Code Colorizer for Wordpress” By Vijesh Mehta from the Plugin section in your Wordpress administration panel. The plugin [...]

  41. Ronald Widha » Blog Archive » The best code formatter/syntax highlighter for WLW on December 4th, 2009 12:49 am

    [...] include Alex Gorbatchev’s Syntax Highlighter Javascript on your blog template. For me, I’m using Wordpress, so I can simply add the reference by using this plugin: Syntax Highlighter and Code Prettifier Plugin for WordPress. [...]

  42. Christophe Rousée » Premiers pas et premiers problèmes sous WordPress on December 15th, 2009 4:01 am

    [...] avoir choisi Syntax Highlighter and Code Prettifier Plugin for WordPress de Vijesh Mehta, Voila que j’ai un problème de saut à la ligne après chaque mot clés : Erreur de retour [...]

  43. Marcus Hellberg » Syntax highlighters on December 21st, 2009 12:05 am

    [...] I settled on using, for the time being at least, is Vijesh Mehta Syntax Highlighter Wordpress Plugin. The plugin still requires manual HTML editing, but avoids the stripping of the name attribute by [...]

  44. ekobudiyanto on December 21st, 2009 2:29 am

    Can we set the number of the code?

  45. 野猫阿罗哈 » 测试代码着色 on December 23rd, 2009 8:33 pm

    [...] 安装了一个插件: Syntax Highlighter Wordpress Plugin [...]

  46. nanohe on January 2nd, 2010 1:44 am

    Hi,

    I installed syntax-highlighter-and-code-prettifier at my blog version 2.8 based. The dashboard alert there are new version ready for upgrade. then i clicked to upgrade. After upgrade, i found all my Highlighter code can’t work now. and strange. I found the plugin website jumped to http://www.viper007bond.com/wordpress-plugins/syntaxhighlighter/. Why? thank you.

  47. WordPress and SyntaxHighlighter | assumption of advancement on January 8th, 2010 4:01 am

    [...] Syntax Highlighter and Code Colorizer for Wordpress [...]

  48. rochacbruno » Blog Archive » Primeiro Post on January 12th, 2010 6:35 am
  49. Kelly Summerlin on January 14th, 2010 12:34 pm

    If your WordPress MU site is stripping the class attribute from the PRE tag, then you can try using the Unfiltered MU plugin.

    http://wordpress.org/extend/plugins/unfiltered-mu/installation/

  50. Rafael on January 15th, 2010 7:59 am

    Hi,

    I have a problem using this plugin for highlight some HTML code. I see that is not listed as a brush but I try with the PHP as an alternative and dont works :(

    This is the code:

    {$lang->author}
    {$lang->message}

    Thanks.

  51. Rafael on January 15th, 2010 8:00 am

    Sorry have the same problem using the brush here.

    Here is the code

    {$lang->author}
    {$lang->message}

  52. Ultimate Fighter on January 19th, 2010 5:05 am

    Page Speed fin many of external javascript:

    # shBrushBash.js
    # shBrushCpp.js
    # shBrushCSharp.js
    # shBrushCss.js
    # shBrushDelphi.js
    # shBrushDiff.js
    # shBrushGroovy.js
    # shBrushJava.js
    # shBrushJScript.js
    # shBrushPerl.js
    # shBrushPhp.js
    # shBrushPlain.js
    # shBrushPython.js
    # shBrushRuby.js
    # shBrushScala.js
    # shBrushSql.js
    # shBrushVb.js
    # shBrushXml.js

    is there a way to combine them in a future version?

  53. DynamicWP » Blog Archive » The Easy Way to Display Source Code in Wordpress Post on January 24th, 2010 2:49 am

    [...] for Vijesh Mehta about this tutorial we just test for wordpress 2.9.1..and still working Posted under: Articles | Tags: code, display [...]

  54. Getting Textmate like syntax highlighting for WP in 10 Minutes | p.Rob on February 16th, 2010 10:27 am

    [...] Syntax Highlighter and Code Prettifier Plugin for WordPress. It has built in themes, installs in 35 seconds, and works like a champ. [...]

  55. wordpress代码着色 | 一个人的乌托邦 on February 17th, 2010 8:23 am

    [...] wordpress代码着色 Taii 发表于 2010-02-17 23:23 | 来源: | 阅读 2 Views 1、安装插件: Syntax Highlighter Wordpress Plugin [...]

  56. wordpress plugins on February 22nd, 2010 3:18 pm

    Can you provide more information on other wordpress plugins, or do you have some resources you can share with us where we can find such useful stuff? Thanks.

  57. Harvey on February 23rd, 2010 10:17 am

    Thanks! This is what I was looking for. I like that you can specify the language, unlike prettify.js, and I love the line numbers since I’m always wanting to refer to specific lines.

    Playing nice with Markdown:
    I’ve found that I have to surround the whole block with or else markdown will sometimes modify the code.

  58. Harvey on February 23rd, 2010 10:20 am

    Try #2:

    With Markdown, make sure to surround you “pre” blocks with “div” tags or else Markdown may mess with your code.

  59. Pam on February 25th, 2010 11:57 am

    It’s not wrapping properly for me in Safari. Long url and code strings are extending outside the code box. It only seems to break at hyphens. Any ideas?

  60. geronime on March 8th, 2010 5:52 am

    Great extension but I have run to the bash > problem too…

    echo “Something” > Somefile

    desplays the redirection as > , shame.

    I removed the ‘lt’ and ‘gt’ keywords from shBrushBash.js , therefore -lt and -gt operators will not be colorized, but that is still better than to replace redirections to > and <

  61. Posting code in wordpress blogs | Applausible Blog on March 8th, 2010 1:11 pm

    [...] Syntax Highlighter [...]

  62. The pain of posting code into wordpress | Some More Bytes on March 9th, 2010 7:29 pm

    [...] I found another great plugin that does its job: SyntaxHL Editor. This one need to install the Syntax Highlighter and Code Colorizer plugin. It had a little problem with my actual wordpress theme, so I discarded it earlier but [...]

  63. Wordpress 代码高亮插件:Syntax Highlighter and Code Prettifier | 博学笃行 | 格物致知 on March 10th, 2010 5:31 am

    [...] highlighter 就可以找到。 官方主页是:http://www.lastengine.com/syntax-highlighter-wordpress-plugin/, [...]

  64. WP实用插件1-Syntax Highlighter | wordpress | Dora on March 11th, 2010 12:43 am

    [...] Syntax Highlighter是一个能使文章中的代码段按照该代码语言的语法对其进行高亮的实用插件 插件官方地址:http://www.lastengine.com/syntax-highlighter-wordpress-plugin/ [...]

  65. Syntax Highlighting Plugin Added « blog@USF on March 11th, 2010 1:26 pm

    [...] The instructions for use are available here. [...]

Leave a Reply