This page last changed on Dec 11, 2007 by smaddox.

There are two ways to write a macro:

  • The first way is to create a user macro. You need to be a Confluence Administrator to do this. Below is an example.
  • The second, and more difficult, way is to create a user plugin.

Example of a User Macro

Here's how you can create a user macro which displays the text 'Hello World : ' in front of any variable text you place between the macro tags.

  1. Go to the 'Administration Console' and click 'User Macros' under 'Configuration' in the left-hand panel.
  2. Click 'Create a User Macro' at the top of the list of macros.
  3. Enter the macro attributes as shown in the following screenshot.
  4. Click the 'Save' button.

So, now you can add the following Wiki Markup on your Confluence page:

{helloworld}Matthew{helloworld}

And the result will be as follows:

More Information

The macro itself is written in the Velocity Templating Language. You can find more information in the Velocity User Guide from Apache.

RELATED TOPICS

User Macros
Macro Plugins


helloWorldOutput.PNG (image/png)
helloworldMacro.PNG (image/png)
helloworldMacro.PNG (image/png)
Document generated by Confluence on Dec 03, 2008 15:14