User macro does not accept rich content

Hi I have created a macro and is working almost fine I have configured bgcolor and TitleBGColor and other things I have moslty used the code on the manual example the probem is that when I add like Bold format is not showed in that way after I have saved the article, also returns are not considered.

this is the code I m using

## @paramTitle:title=Title|type=string|desc=Title

<ac:macro ac:name="panel">
<ac:parameter ac:name="titleBGColor">#c6ffc4</ac:parameter>
<ac:parameter ac:name="bgColor">#ffffff</ac:parameter>
<ac:parameter ac:name="borderStyle">solid</ac:parameter>
<ac:parameter ac:name="borderColor"></ac:parameter>
<ac:parameter ac:name="borderWidth">3</ac:parameter>
<ac:parameter ac:name="titleColor">#000000</ac:parameter>
<ac:parameter ac:name="title">$!paramTitle</ac:parameter>
<ac:rich-text-body>$body</ac:rich-text-body>
</ac:macro>

you can see my page here http://legajo-virtual.com:8090/pages/viewpage.action?pageId=557129

2 answers

1 accepted

1 vote
David Simpson Community Champion Mar 19, 2014

Your user macro is a wrapper for the Panel macro, so the best way to test correct behaviour would be to add a Panel macro to a page them go to Tools | View Storage Format to get the resulting XML storage.

My first attempt with HTML nested in the body of a Panel macro gave:

&lt;ac:structured-macro ac:name="panel"&gt;
	&lt;ac:parameter ac:name="bgColor"&gt;limegreen&lt;/ac:parameter&gt;
	&lt;ac:parameter ac:name="title"&gt;dsafd&lt;/ac:parameter&gt;
	&lt;ac:parameter ac:name="borderStyle"&gt;solid&lt;/ac:parameter&gt;
	&lt;ac:parameter ac:name="borderColor"&gt;hotpink&lt;/ac:parameter&gt;
	&lt;ac:rich-text-body&gt;o &lt;em&gt;what&lt;/em&gt; &lt;strong&gt;is&lt;/strong&gt; this?&lt;/ac:rich-text-body&gt;
&lt;/ac:structured-macro&gt;

It looks like you need to swap out ac:macro with ac:structured-macro to produce:

&lt;ac:structured-macro ac:name="panel"&gt;
	&lt;ac:parameter ac:name="titleBGColor"&gt;#c6ffc4&lt;/ac:parameter&gt;
	&lt;ac:parameter ac:name="bgColor"&gt;#ffffff&lt;/ac:parameter&gt;
	&lt;ac:parameter ac:name="borderStyle"&gt;solid&lt;/ac:parameter&gt;
	&lt;ac:parameter ac:name="borderColor"&gt;&lt;/ac:parameter&gt;
	&lt;ac:parameter ac:name="borderWidth"&gt;3&lt;/ac:parameter&gt;
	&lt;ac:parameter ac:name="titleColor"&gt;#000000&lt;/ac:parameter&gt;
	&lt;ac:parameter ac:name="title"&gt;$!paramTitle&lt;/ac:parameter&gt;
	&lt;ac:rich-text-body&gt;$body&lt;/ac:rich-text-body&gt;
&lt;/ac:structured-macro&gt;

Thank you for your answer but I got the same results, reading a litte more I realized that when following the manual instructions for building a new user macro for a panel the manual say you should select "Escaped" mode. The solution was to select "Represented" on macro user definition, both of my code and yours work fine.

The solution: I realized that when following the manual instructions for building a new user macro for a panel the manual says you should select "Escaped" mode. The solution was to select "Represented" on macro user definition.

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
Published Thursday in Confluence

Color tables for a shiny Confluence page

...; ## Developed by: Alana Fernando ## Shared with love ## @param style:title=style type|type=enum|required=true|desc=Choose a style.|enumValues=Style1,Style2,Style3,Style4,Style5 ## @param alignment:title...

141 views 8 10
Read article

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