views:

191

answers:

2

I am very curious to know how to implement the Ctrl-K (code sample) feature against code, For example:

public static void main(String args[]){
  System.out.println.out("welcome");
}

That will be nicely formatted?

  1. Do we require any package to implement this?
  2. Any ready made code available to do this?

Can any one help me with this? I am planning to develop a site where this feature would be a real helpful.

A: 

Do we require any package to implement this?

You need some software.

Any ready made code avaialble to do this?

SO uses markdown. There are implementations for most popular languages.

David Dorward
+2  A: 

I guest you are looking for Google Javascript code prettifier.

As rsp mentioned in comments it works for following list of languages.

Grzegorz Gierlik
@Gierlik, does that work for all the languages
harigm
@harigm, look at the test page: http://google-code-prettify.googlecode.com/svn/trunk/tests/prettify_test.html
rsp