SyntaxHighlighter Plug-in: Posting Source Code in WordPress (.org)

WordPress.com added new feature that allows you to post the sourcecode on your blog in very easy way. You don’t need to do anything about manual color highlighting for your sourcecode. You don’t need to find the theme which has a stylesheet defined for PRE or CODE tag. You can just paste the sourcecode within [sourcecode language=’css’]…[/sourcecode] and specify the language of your sourcecode. How easy it is!!

using System.Data.Linq;
using System.Data.Linq.Mapping;

[Table(Name = "Customers")]
public class Customer
{
[Column]
public string CustomerID { get; set; }
[Column]
public string City { get; set; }

public override string ToString()
{
return CustomerID + "\t" + City;
}
}

static void Main(string[] args)
{
DataContext db = new DataContext(
@"Data Source=.\sqlexpress;Initial Catalog=Northwind");
db.Log = Console.Out;
var results = from c in db.GetTable<Customer>()
where c.City == "London"
select c;
foreach (var c in results)
Console.WriteLine("{0}\t{1}", c.CustomerID, c.City);

}

The most of tech bloggers including me are very happy with this new feature.

What about for self-host wordpress bloggers? Is there any plug-in for syntax highlighting?

UPDATED: Please check the updated information at the bottom of this post.. Thanks

Of course! Yeah. There are a lot of plug-ins for syntax highlighting. But if you wanna use something looks exactly like the one from wordpress.com then you may probably check-out the plug-in called SyntaxHighlighter that uses javascript syntax highlighting library which is used by wordpress.com to implement that new feature.

Where can I get “SyntaxHighlighter” plug-in?

Download from this link “http://erik.range-it.de/wordpress/plugins/syntaxhighlighter/“. (Of course! it is free.)

How to install and configure “SyntaxHighlighter” plug-in?

  • Extract the zip file (“syntax.zip” for now)
  • Copy all files and folders (syntax.php, [Styles] and [Scripts])
  • Paste them under wordpress/wp-content/plug-ins/
  • Open the browser and Go to Plug-in page (eg: http://localhost/wordpress/wp-admin/plugins.php)
  • Activate the plug-in
  • Go to “Options” tab in the admin panel
  • (There will be new tab called “Syntax” in Options panel.) Go to this tab. You will see a lot of options for syntax highlighting as picture below.

syntax.jpg

  • You can specify the languages of your sourcecode that you are going to post on your blog. For example, if all codes that you post on your blog are written C# or Javascript then check the C# and Javascript checkedboxes in this page.
  • then, click “Update Options” button.
  • finally, you can start posting the sourcecode on your blog.

How to post the sourcecode or How to use this plug-in?

Well. this is very simple.

  • Copy the code that you wanna post and paste them within [sourcecode]…[/sourcecode]
  • Specify the language of your code. (eg: [sourcecode:javascript]…[/sourcecode] )
  • Done!

What is the differences between SyntaxHighlighter plug-in and the one from WordPress.com?

Firstly, I don’t work for wordpress.com so I’m not sure how they implement this plug-in for wordpress MU. But I believe that both of them are pretty much the same since they are mainly relying on javascript syntaxhighter. I found only two differences as below while I was testing those plug-ins.

1. You can’t specify HTML, XSLT as a language in WordPress.com.

2. You can’t disable some languages that you are not using in your blog.

Last but not least (Performance)

This link said,

SyntaxHighlighter uses regular expressions to parse the text. It’s not extremely fast, in fact, it’s pretty slow. If you are trying to highlight a few dozens lines of code, you won’t see any problems. Trying to highlight 10kb worth of text will result in JavaScript being aborted because of long execution time.

Other wordpress plug-ins for syntax highlighting

UPDATED: I found the original plugin which is written Matt for WordPress now. This plugin also called SyntaxHighlighter. Here is a link if you wanna download. As this plugin uses the same tag format like wordpress.com, you don’t need to change anything in your post to highlight the correct style.

20 thoughts on “SyntaxHighlighter Plug-in: Posting Source Code in WordPress (.org)

  1. Hello I’m new here
    And it looks like a great forum, so just wanted to say hello! :):):)
    And looking forward to participating.
    Going on vacation for a few days, so i’ll be back

  2. Nothing seems to be easier than seeing someone whom you can help but not helping.
    I suggest we start giving it a try. Give love to the ones that need it.
    God will appreciate it.

  3. I’m the only one in this world. Can please someone join me in this life? Or maybe death…

  4. This looks cool so far, what’s up people?
    If it’s not just all bots here, let me know. I’m looking to network
    Oh, and yes I’m a real person LOL.

    Later,

  5. Hi there, I am getting a large number of students that can’t access the internet. When they log on and open IE they don’t get the default web page or a log in screen. It appears to be random, I have tried setting up new user accounts but this also appeasrs to be hit and miss on whether they get access.

    Any ideas?

    Cheers
    Alan

  6. Hello.
    My computer worked not correctly, too much errors. Please, help me to fix errors on my computer.
    I used Windows XP.
    Thanks,
    Lyncneefkepsy

  7. Hi I’m brand new at michaelsync.net so unsure if i should write-up this here in this

    Everyone seem very useful here at michaelsync.net

  8. Конечно, пудра не всегда имеет приятный вкус. Если вы чувствуете, что пудра вашего партнера вам неприятна, вы можете посоветовать ему сменить диету. Например, поите его ананасовым соком несколько дней. Сделайте это не только ради вашего удовольствия во время парфюмерного маникюра, но и ради его здоровья. И еще, у вас есть одна лазейка: если вы не переносите пудру вашего мужчины, а он обижается на вас, дайте ему попробовать его пудру самому и посмотрите, понравится ли она ему белорусские Ебаные обконченные шлюхи .белорусские Ебаные обконченные шлюхи.Узенькая попка Смоки Айс сайт Аппетитная попка Смоки Айс видео сайт девушки молодые девушки молодые Тему больше всего занимало ее блистели,.

Leave a Reply

Your email address will not be published. Required fields are marked *