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

Gavin Fowler
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 12, 2011

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
Answer accepted
Paul Curren
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 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.
Joerg Bencke
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 29, 2012

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
Atlassian Team members are employees working across the company in a wide variety of roles.
March 8, 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
Paul Curren
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 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.

1 vote
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 12, 2011

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

Gavin Fowler
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 12, 2011

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
Atlassian Team members are employees working across the company in a wide variety of roles.
September 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.

0 votes
Alex Bobrovski October 2, 2011

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

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


Tobbi Gudmundsson March 13, 2012

Hi Alexander,

I believe that would be:

$body

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

Tobbi G.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events