Confluence 4.0 User Macro - Wiki markup template must now be HTML
Asked by Gavin Fowler:

I'm exploring the RC3 version of confluence 4.0, to get a handle on what's required to upgrade when the stable version is launched.

All is good so far, but I'm a little confused by the changes to the "user macro", which no longer appears to support wiki markup as an output format (just HTML now). I have a series of macro's that were created (not by myself) which are all using standard wiki markup in the macro template.

my question is - does this really need to be converted to HTML or is there somethgin I'm missing in the beta documentation?? For example - one macro uses the following template:

```
{panel:title=On this page|borderStyle=solid|borderColor=#3C78B5|titleBGColor=#eeeeee|bgColor=#ffffff}{toc:minlevel=2|maxLevel=$body}{panel}
```

As you can see it used two wiki markup macros {panel} \& {toc}. Surely I dont have to construct these manually now using HTML do I?? Does anyone have an example of mixing HTML with wiki markup macros to extened the confluence feature set (in my case to create a stanbdard look / feel for page headers).

Apologies if this is a noob question - i'm just not getting it??


Answers:
author: Paul Curren
body: If you want to be ahead of the game and get your user macros over to 4.0 as early as possible (good on you! :-) )then you could make use of the 'view-storage-format' plugin.

You need to be an admin to do this...

1. Create a new (dummy) page and create the content that you want to be the body of your user macro
2. Restrict this page to just yourself before saving (since it's a temporary scratch pad)
3. Save the page and choose 'view-storage-format' from the 'Tools' menu
4. Copy and paste the content to your user macro
5. Delete the page, or not.

comments: author: Joerg Bencke
body: Hi Paul,

with 4.1.3, that wont work for usertemplates. I pasted the XHTML and it was stored like "code" tagged content - unrendered.

Once i manually wrote it down as wikimarkup, using the XHTML just as reference source for macronames and parameternames, it worked.

Alternative I prefer : use the 3.5. Documentation to read up the wiki-markup codes


author: Paul Curren
body: Hi Josch.

I have just checked and this still work with 4.1.3 and newer. Remember you need to set the macro body processing to 'Rendered'

(The explanation on the screen says it best: The body will be rendered so most HTML entered will be passed to the template unmodified but Confluence specific mark up such as macro definitions will be rendered.).

I hope that helps.


author: Paul Curren
body: Hi there.

You can actually leave your wiki formatted user macros as they are at the moment.

The administration screen will show you a warning stating -

*"For these macros to continue working in future versions of Confluence they must be manually changed to use HTML templates."*

Since we don't have the XHTML Editor enabled in places such as user macro creation we have left support for wiki markup in the meantime. It is unlikely that we will drop support for wiki markup in user macros until we offer a more feasible alternative to expecting you to enter XHTML formatted data into a plain textarea.

(This is being investigated for 4.1 but I can make no guarantees at this stage of when it might be ready.)

Finally though, for your user macro to be readily available in the new 4.0 Editor you will need to make sure you have configured Macro Browser metadata. See the [Quick Administrator Tips](http://confluence.atlassian.com/display/DOC/Quick+Administrator+Tips+To+Prepare+for+Confluence+4.0#QuickAdministratorTipsToPrepareforConfluence40-4Upgradeyourusermacros-Now) for more details.


author: Nic Brough -Adaptavist-
body: I'm afraid you will need to convert them - 4.0 doesn't have wiki markup any more. I haven't tried it myself, but there is a macro that will let you use markup inside it, so maybe wrapping that into your macros might help, but in the long run, you should convert to HTML

comments: author: Gavin Fowler
body: Thanks for the feedback Nic, appreciate your insight here. One further question if you don't mind. How can i leverage standard features within confluence, such as table of contents {toc} (as in my example) - will I essentially have to make calls to the API using java like syntax? just want to get a handle on what sort of challenge i'm setting my self up for.


author: Paul Curren
body: The "correct" way to make use of other macros within a new user macro is to specify it in XHTML format.

So for a toc macro with all default parameters you would specify -

*\<ac:macro ac:name="toc" /\>*

To set a style on the toc macro -

*\<ac:macro ac:name="toc"\>\<ac:parameter ac:name="style"\>circle\</ac:parameter\>\</ac:macro\>*

You can probably derive the pattern for specifying further parameters.

Obviously this could get unweildy pretty quickly which is why we hope to get a proper Editor available soon.


author: Alex Bobrovski
body: Hi, how to call body of the macro? In my macro I use the **info** macro .

*\<ac:macro ac:name="info"\> BODY? \</ac:macro\>*

comments: author: Tobbi Gudmundsson
body: Hi Alexander,

I believe that would be:

```
$body
```

More information: <http://confluence.atlassian.com/display/CONF35/Writing+User+Macros#WritingUserMacros-Template>

Tobbi G.


Tags: macro