Confluence 5.7 has reached end of life
Check out the [latest version] of the documentation
This example demonstrates how to create a user macro that displays the text 'Hello World!' and any text that the user places in the body of the macro.
Before you start, see Writing user macros for an introduction to creating your own user macros.
To create the 'Hello World' user macro:
Field | Value |
---|---|
Macro name | helloworld |
Visibility | Visible to all users in the Macro Browser |
Macro Title | Hello World |
Description | Displays "Hello World" and the macro body. |
Categories | Confluence Content |
Icon URL | You can leave this field blank |
Documentation URL | You can leave this field blank |
Macro body processing | Rendered |
Template | Enter the code below in the template field - this example will print the text straight onto the page. ## @noparams Hello World! $body If you wanted the text to appear in a panel you could include the relevant AUI message class as shown here. ## @noparams <div class="aui-message closeable"> Hello World! $body </div> |
Now you can add the macro to your Confluence page using the Macro Browser, or by typing {hello in the editor and selecting the macro from the list of suggestions.
The result is:
If you chose to include a panel, the result would be: