• New Syntax Highlighter

    We have installed a new Syntax Highlighter on the forums, so we can highlight other languages then only PHP and HTML.

    The new Syntax Highlighter uses the standard [code] BB-Code with optionally the language specified by using the [code=language-code] syntax.

    Basic Usage

    If no language-code is specified the Syntax Highlighter will default to using Java. For some forums that deal with specific languages other then standard Java the default will be set to that specific language, for example the JavaFX forum will use "javafx" as default language.

    Examples:

    [code]public class HelloWorld {

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

    }[/code]
    Would result in:
    Java Code:
    public class HelloWorld {
    
        public static void main(String[] args) {
            System.out.println("Hello, World");
        }
    
    }
    This would be the same as specifying "java" for the language code:

    [code=java]public class HelloWorld {

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

    }[/code]
    Would result in:
    Java Code:
    public class HelloWorld {
    
        public static void main(String[] args) {
            System.out.println("Hello, World");
        }
    
    }
    Or using PHP as language:

    [code=php]<?php
    echo "Hello World.";
    ?>[/code]
    Would result in:
    PHP Code:
    <?php
    echo "Hello World.";
    ?>
    Advanced Usage

    Optionally you can also give the code block a title by following the language code with a semi-colon (;) and the Title text.

    Example:

    [code=java;This is the standard Hello World JAVA demo application]public class HelloWorld {

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

    }[/code]
    Would result in:
    Java Code: This is the standard Hello World JAVA demo application
    public class HelloWorld {
    
        public static void main(String[] args) {
            System.out.println("Hello, World");
        }
    
    }
    Copying text from a code block

    You can easily select all the text in a code block by double-clicking anywhere in the code block. In order to copy it to your clipboard, press Ctrl-C (Windows) or Command-C (Mac).

    Available Languages

    Currently the following language are available. They are listed together with their possible language-codes, use the language-code in the [code=language-code] BB-Codes.

    Brush Aliases
    AppleScript applescript
    ActionScript3 as3, actionscript3
    Bash bash, shell
    Cold Fusion cf, coldfusion
    C Sharp c-sharp, csharp
    C++ cpp, c
    CSS css
    Delphi delphi, pas, pascal
    Diff diff, patch
    Erlang erl, erlang
    Groovy groovy
    JavaScript js, jscript, javascript
    Java java
    Java FX jfx, javafx
    Perl perl, pl
    PHP php
    Plain Text plain, text
    Power Shell ps, powershell
    Python py, python
    Ruby On Rails ruby, rails, ror
    SASS sass
    Scala scala
    SQL sql
    Visual Basic vb, vbnet
    XML xml, xhtml, xslt, html

    Known limitations:

    In the current version a code block will not be syntax highlighted if you use the inline editor to edit a post. After a page refresh the code will show correctly.