Blogging code


I’ve already written about the problems you’ll encounter, when needing to HTML-ify a source code. The presented solution by Dan Kogi is a work-around solution, if you’ll need special characters to be transformed into HTML entities. Anyhow, if you’ve got a wordpress.com account, there’s a more elegant way. I just found out, that wordpress.com has a widget installed, that allows you to post code, that’ll get syntax highlighted, so, it’ll be possible to post something like this:

/* A little Hello widget application in Java */
 
public class HelloWidget {
   public static void main(String[] args){
       System.out.println("Hello, Blogommunity!");
   }
}

Pretty neat, isn’t it? I especially enjoy those small icons on the upper right corner (you’ll need JavaScript enabled for this to work!) that allow you to copy the text into clipboard or just let you view it, as is (ideal for copying parts of it, without having to mess around with the line numbering).

As you can read on their support page this widget is based on the code written by Alex Gorbatchev. Unfortunately, since now, wordpress.com only supports a view (rather famous) codes:

  • Bash Script
  • C++
  • C#
  • CSS
  • Delphi
  • HTML
  • Java
  • JavaScript
  • PHP
  • Python
  • Ruby
  • Shell
  • SQL
  • Visual Basic
  • XML

Now for me that actually pretty sucks. Besides Java I’d need Smalltalk (Squeak and VisualWorks Syntax), DrScheme, Haskell, Perl, …

Some of those are even available at Alex Gorbatchev‘s – anyway I’d need administrative rights on wordpress.com to get those working… now who’d bet that I’d get them? It’s time for me to find my self a neat little root space…

Anyhow I can also use the source code tag without any attributes. So instead of doing something like this:


/* A little Hello widget application in Java */
…

I could simply use:


/* A little Hello widget application in Java */
…
Advertisements

Please comment. I really enjoy your thoughts!

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s