Tuesday, 22nd June 2010
The new frontier for learning Java

WikiJava:Highlighting code

From WikiJava

Jump to: navigation, search

The code in a page must be in the form:

<source lang="{language name}">{code}</source>

where:

  • {language name} is the name of the language of the code (for example 'java')
  • {code} is the actual code you want to represent in the page.

For example:

for (int i = 0; i < elements.length(); i++){
    count = elements.get(i).getDuration();
}

Is created by this text:

 <source lang='java'>
 for (int i = 0; i < elements.length(); i++){
    count = elements.get(i).getDuration();
 }
 </source>