Available: | Confluence 2.3 and later |
To create user macros without writing a plugin, define the user macro in the Confluence Administration Console. For more information see Writing user macros.
User macro is a kind of Confluence plugin module.
With user macro plugin modules, developers can define simple macros directly in the atlassian-plugin.xml
file
without writing any additional Java code. User macro plugin modules are functionally identical to user macros configured through
the administrative console, except that they can be packaged and distributed in the same way as normal plugins.
User macros installed as plugin modules do not appear in the user macro section of the administrative console, and are not editable from within the user interface. They appear just as normal plugin modules in the plugin interface.
Configure entire macro plugin modules inside the atlassian-plugin.xml
file as follows:
1 2<atlassian-plugin name='Hello World Macro' key='confluence.extra.helloworld' pluginsVersion='2'> <plugin-info> <description>Example user macro</description> <vendor name="Atlassian Software Systems" url="http://www.atlassian.com"/> <version>1.0</version> </plugin-info> <user-macro name='helloworld' key='helloworld' hasBody='true' bodyType='raw' outputType='html'> <description>Hello, user macro</description> <template><![CDATA[Hello, $body and $paramexample !]]></template> <parameters> <parameter name="example" type="string"/> </parameters> </user-macro> <!-- more macros... --> </atlassian-plugin>
<template>
section is required. It defines the velocity template that renders the macro.user-macro
element match the configuration for user macros (see available attributes later on this page).parameter
elements are the same as for xhtml-macro.If your macro doesn't define any parameter
, you should leave <parameters>
tag empty.
Attribute | Allowed Values |
---|---|
hasBody |
|
bodyType |
|
outputType |
|
Rate this page: