Dashboard > Confluence User Guides and Documents > ... > Working with Macros > Code Block Macro
Code Block Macro Log In   View a printable version of the current page.

Added by vidya, last edited by smaddox on Jul 11, 2007  (view change)
Labels: 
(None)

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.

Code Block Macro

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


Example 1: Java

What you need to type What you will get
{code}
public String getFoo()
{
return foo;
}
{code}
public String getFoo()
{
    return foo;
}



Example 2: XML

What you need to type What you will get
{code:XML}
<test>
<another tag="attribute"/>
</test>
{code}
<test>
    <another tag="attribute"/>
</test>
RELATED TOPICS

Working with Macros
Adaptavist User Guide

Take me back to Confluence User Guide

DEMONSTRATION LICENSE - This Confluence site is for demonstration purposes only. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.6.1 Build:#916 Nov 09, 2007) - Bug/feature request - Contact Administrators