Confluence 4.0 User Macro - Wiki markup template must now be HTML

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??

4 answers

1 accepted

2 votes
Paul Curren Atlassian Team Sep 13, 2011

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.

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

Paul Curren Atlassian Team Mar 08, 2012

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.

1 vote

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

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.

Paul Curren Atlassian Team Sep 12, 2011

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.

1 vote
Paul Curren Atlassian Team Sep 12, 2011

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 for more details.

Hi, how to call body of the macro? In my macro I use the info macro .

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


Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Monday in Confluence

Calling all marketing teams who use Confluence - we want to hear from you!

Hi Community! me again 🙂 If you’re a marketing team using Confluence, we want to hear your story! How did you start using Confluence? What are your use cases? What have been some of the benefits?...

226 views 3 3
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you