The Code Block Macro allows you to display source code in your document with the appropriate syntax highlighting. The code block displays on the page as shown below.
public static void main(String[] args)
{
System.out.println("Hello World!");
}
|
On this page:
To insert the code block macro into a page using the Macro Browser,
|
Once you've found the code block macro, click 'insert' to add it to your page. |
What you need to type |
What you will get |
||
|---|---|---|---|
|
|
Parameter |
Default |
Description |
|---|---|---|
Code Language |
Java |
Specifies the programming language for syntax highlighting. The default language is Java but you can specify JavaScript, ActionScript, XML, HTML or SQL instead. |
Be aware that any white space contained between the {code} commands is not manipulated in any way by the Code Block Macro. This is to provide the writer with flexibility over code indentation.
All the optional parameters of the {panel} macro are valid for the {code} macro as well.
Example 1: Java
What you need to type |
What you will get |
|
|---|---|---|
{code} |
|
Example 2: XML
What you need to type |
What you will get |
|
|---|---|---|
{code:XML} |
|
Example 3: HTML
What you need to type |
What you will get |
|
|---|---|---|
{code:HTML} |
|
Working with Macros
Adaptavist User Guide
Take me back to the Confluence User's Guide.