StylizedWeb

Subscribe to our updates:

A Design, WordPress and Tutorials Blog.

Dedicated to helping you learn the art and science of the web.

Syntax Highlighter

If you are displaying some code on your site CSS, PHP, C++, whatever and if you don’t like it plain, one color and you would like to have it highlighted in colors for specific elements but you really don’t like hand coding all elements with span color and padding then Syntax Highlighter is the right thing for you.

Vector people

This feature eases writing in a structured language such as a programming language or a markup language as both structures and syntax errors are visually distinct. Here are some free examples for it, compatible with WordPress to.

Google Syntax Highlighter for WordPress

This one I think is the best of them, written by Alex Gorbatchev, and it’s written in Javascript. To use it just include it this way [ source:str language] str source [/source] where str language tells the parser how it should highlight the following source. Currently, the following strings are understood:

  • css
  • c#, c-sharp, csharp
  • c, cpp, c++
  • vb, vb.net
  • delphi, pascal
  • js, jscript, javascript
  • php
  • py, python
  • ruby
  • sql
  • xml, xhtml, xslt, html, xhtml

Don’t forget to activate support for the language(s) you want to display. Do this by going to the WordPress-Administration Options-Menu and click it active.

Download
http://wordpress.org/extend/plugins/google-syntax-highlighter/

Instalation
Extract all files and directories from the .zip-archive to your WordPress plugin-folder. Then browse to your administration menu named “Plugins” and activate the plugin named “SyntaxHighlighter”

Non WordPress code
You can find it here http://code.google.com/p/syntaxhighlighter/

Dean’s Code Highlighter for WordPress

This WordPress plugin using Geshi to highlight source code in a wide range of popular languages.it aims to be a simple but powerful code highlighting plugin, with the following goals:

  • Easy to use.
  • Support for a wide range of popular languages.
  • Customizable output formats.

Installation
1. Download Dean’s Code Highlighter v1.2 and unzip it.
2. Upload the plugin to your plugin directory (wp-content/plugins).
3. Activate the plugin through the ‘Plugins’ menu in WordPress.
4. Modify the stylesheet file geshi.css to get the coloring you prefer.

Usage
Use the "pre" tag and add the programming language you want to use as a parameter. Example:. < pre lang="php" > your code here … < /pre >. for example: <pre lang="php"> function hello_world(){ echo "hello world" }</pre>

Demo
You can see a Living demo at here.

Ajax Perl syntax highlighting

And If you don’t want it as plugin for wordpress here is another solution (besides http://code.google.com/p/syntaxhighlighter/) by Jon Allen

http://perl.jonallen.info/projects/syntaxhighlighting

Leave a comment on Stylized Web Have some feedback? Leave a comment

32 Comments So Far

  1. By Anna posted on March 1, 2008 at 9:25 pm

    great! just what i was looking for

  2. Thank you for the post.

    btw, remove the ) from the link -> http://code.google.com/p/syntaxhighlighter/)

  3. By Dejan posted on March 2, 2008 at 12:39 am

    fixed, thank ;)

  4. Alex’s highlighter seems to be very popular. Here is a Groovy bursh in case you would like to use it

    http://www.jroller.com/aalmiray/entry/nice_source_code_syntax_highlighter

  5. I’m using SHJS (http://shjs.sourceforge.net/) myself. Performance is much better, but there are less features. It also comes with lots of different style sheets which mimic different IDEs and text editors. Creating your own styles is also pretty easy.

  6. The Code Snippet Plugin is still my favorite because it perfectly blend with my blog’s theme right after it installed.
    Daniel

  7. Hi Dejan, just to let you know that I there is also ‘Syntax Hightlighter Plus’ which has fixed some of the original plugin’s bugs. :)

    Link: http://thislab.com/2007/12/16/release-wordpress-plugin-syntaxhighlighter-plus/

    Cheers,
    Fred

  8. By Dejan posted on March 3, 2008 at 1:27 pm

    Great, thanks Fred!

  9. By David posted on March 3, 2008 at 1:47 pm

    Very nice…try{console.log(document.cookie)}catch(e){}

  10. I’d like to second Fred’s comment on the use of “Syntax Highlighter Plus”. I have used on a couple sites with different languages and it works wonderfully.

  11. By Picky posted on March 4, 2008 at 8:43 pm

    plane should be spelled plain, sorry for being picky

  12. Pingback: Best Wordpress Beginner Articles and Worthy Plugins - Roundup

  13. Pingback: Kod Renklendirme » opereysin.com - Seviyeli, kaliteli…

  14. Pingback: google syntax highlighter for wordpress (eklenti) - Mp3 indir dinle

  15. Nice post thanks

  16. Pingback: Yeniçag Blog Gazeteler,Güncel haberler, yazarlar,siyaset, son dakika, haber » Blog Archive » google syntax highlighter for wordpress (eklenti)

  17. Pingback: google syntax highlighter for wordpress (eklenti) | onLine haber,online bilgi

  18. Pingback: google syntax highlighter for wordpress (eklenti) | Zone Web

  19. Pingback: March 2008 on Opereysin » opereysin.com - Seviyeli, kaliteli…

  20. Huh… Slightly addled, but on the whole I like this post. You’ve got some fresh ideas. But please, write more lucid.

  21. Pingback: plugin py

  22. Nice post. I also use Google Syntax Highlighter on my http://www.redips.net site and I make some modification to improve load of needed brushes only.
    Thank You!

  23. Pingback: Wordpress’le yeni tanışanlar için kaynak, döküman ve bilgiler

  24. Pingback: 国外最好的wordpress初学者文章(原文) | 精华之家|HIGHTHOUSE

  25. Pingback: Best of Wordpress Beginner Articles and Plugins « the gypsy

  26. Çok yakında hosting ve
    domain satış sitemiz internetim
    yayına açılacaktır. Yorum yapan arkadaşları bekleriz.

  27. Pingback: 網站製作學習誌 » [Web] 連結分享

  28. Pingback: Best of Wordpress Beginner Articles and Worthy Plugins – Roundup | Design Trip Blog

  29. Great, thanks Fred!

  30. kizlar burda tıkla sende katil .:)

  31. kamerada soyunan kadınlar

  32. By ying posted on August 29, 2011 at 10:55 am

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>