Syntax Highlighting Examples

From Second Life Wiki
Revision as of 02:20, 8 April 2015 by Cerise Sorbet (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


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

<source lang="Language">


<syntaxhighlight lang="Language">

where Language is the code for the programming or markup language being used. (Both forms work the same way, <syntaxhighlight> is handy for when the source code example itself contains a <source> tag.)

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

  • lsl2: Linden Scripting Language
  • cpp: C++
  • bash: Bash shell
  • html4strict or html5: HTML
  • javascript: Javascript
  • perl: Perl
  • php: PHP
  • python: Python
  • sql: SQL
  • xml: XML


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


Text before code.

    $v = "string";    // sample initialization
html text
    echo $v;         // end of php code

Text after code.


Text before code.

 # Hello World in Python

 def main():
     print "Hello World!"
 if __name__ == '__main__':

Text after code.


Text before code.

#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.

<h1>OMG Look at This</h1>
<p class="youknowsit">Wait where did he get that penguin from?</p>

Text after code.