Syntax Highlighting Examples

From Second Life Wiki
Revision as of 11:39, 14 February 2012 by Rand Linden (talk | contribs)
Jump to navigation Jump to search


This is a rather old extension that enables including code with syntax highlighting. To use, it, enclose your code in tags like this


where Language is the code for the programming or markup language being used.

The documentation lists a large number of supported languages, but the ones most likely to be useful here are

  • cpp: C++
  • bash: Bash shell
  • html4strict: HTML
  • javascript: Javascript
  • perl: Perl
  • php: PHP
  • python: Python
  • sql: SQL
  • xml: XML



if (type == 0)
       else if (type == 1)

... </lsl>


Text before code. <php><?php

   $v = "string";    // sample initialization

?> html text <?

   echo $v;         // end of php code

?> </php> Text after code.


Text before code. <python> # Hello World in Python

def main():
    print "Hello World!"

if __name__ == '__main__':

Text after code.


Text before code.

<cpp>#include <iostream>

int main(int argc, char** argv) {

   std::cout << "hai, can i haz c++ nao?" << std::endl;
   return 0;


Text after code.


Text before code.


OMG Look at This

Wait where did he get that penguin from?


Text after code.