(info) You need to edit in 'Wiki Markup' mode to include macros in your page.

The Code Block Macro allows you to display source code in your document with the appropriate syntax highlighting.

All the optional parameters of the {panel} macro are valid for {code} too.

You can specify the programming language. 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.

コー​ド ブロック マクロ

{code:language} ... code ... {code}
OR
{code} ... java code ... {code}


Example 1: Java

必要な入力項目

表示結果

{code}
public String getFoo()
{
return foo;
}
{code}

public String getFoo()
{
return foo;
}



Example 2: XML

必要な入力項目

表示結果

{code:XML}
<test>
<another tag="attribute"/>
</test>
{code}

<test>
<another tag="attribute"/>
</test>



Example 3: XML (with indentation)

必要な入力項目

表示結果

{code:XML}
<test>
    <another tag="attribute"/>
</test>
{code}

<test>
    <another tag="attribute"/>
</test>
関連トピック

Working with Macros
Adaptavist User Guide

Take me back to Confluence User Guide