How do I configure my Rich Text macro to receive unformatted input?
|Applies To:||Confluence 4.0 and later|
When writing a bodied macro, developers can access the body content entered by the user in the
body parameter of the Macro class'
Developers may define their macro body as
PLAIN_TEXT. By default, the body of a Rich Text macro is automatically rendered by Confluence and converted from Confluence Storage Format to rendered HTML before it is passed in to the macro's execute method. However, it is somtetimes necessary for a developer to access the un-rendered, raw Storage Format of the macro - and handle the rendering manually.
In earlier versions of Confluence, this was possible by setting the
getBodyRenderMode method to return a value of
RenderMode.NO_RENDER. However, this method is no longer available on the macro definition in Confluence 4.0 and later.
The new way to do this is by using the
RequiresFormat annotation. Add the
RequiresFormat annotation to your
execute method and set the value to
Storage. Here's a trivial example: