How a Confluence customize macro image placeholder source generated? Edited

Here is a customized macro image placeholder:

<p><img class="editor-inline-macro" src="/plugins/servlet/confluence/placeholder/macro?definition=e2NvbnRlbnRieWxhYmVsOmNxbD1sYWJlbCA9ICJkYWdkYS1ib2FyZCJ9&amp;locale=en_GB&amp;version=2" data-macro-name="contentbylabel" data-macro-parameters="ppr=rcs &quot;dagda-board&quot;" data-macro-schema-version="3"><br></p>

The "definition=" part of "src" seems generated automatically. And for each macro should has its unique "definition" value.   Just curious that how it created by what kind of rules? Any document mentioned these knowledge?

And any possible reason that may cause macro image placeholder

"src"  SAME?


Thanks in advance.

1 answer

1 vote
Minh Tran Atlassian Team Jan 08, 2018

Hi @AustinS,

I assume you are able to access to Confluence source code. The above image is generated via this servlet com.atlassian.confluence.tinymceplugin.placeholder.MacroPlaceholderServlet

You can check it out the logic and the rule from inside the doGet method of this class

That is true as you guessed. The "definition" part of the url contains the macro definition information

That you can refer to the class com.atlassian.confluence.xhtml.api.MacroDefinition

And the logic to render that url is placed in this class com.atlassian.confluence.content.render.xhtml.editor.macro.CustomImageEditorMacroMarshaller, see marshal method for further information

I hope this helps


Minh Tran

Thanks for these helpful information, Minh. 

One more question related to this, I'm developing a user macro that will be used multiple time on one page, and I found "Edit" button which under <div class="panel-buttons" > and belongs to <a href="#" class="aui-button macro-placeholder-property-panel-edit-button first"> element, is SHARED by any user macro of one Confluence page. That means for these user macros on same page, "Edit" feature don't know / can't identify which macro should be edited.  

Is there a workaround can be used to edit user macros on the same page and can get properties (parameters) of each macro correctly when re-open or re-edit it? Or any API can I use in user macro? How do I do it?  

I know in non user macro, which has preview, "Edit" button can identify which one is which one on a page, and can retrieve macro properties correctly.  I used "


" to override the "opener" to open my own custom "MacroBrowser".  But I'm not sure why "Edit" button doesn't work to retrieve the macro's parameters when we re-open and edit it.

Thank you.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 12, 2019 in Confluence

Confluence Admin Certification now $150 for Community Members

More and more people are building their careers with Atlassian, and we want you to be at the front of this wave! Important Dates Start the Certification Prep Course by 2 April 2019 Take your e...

267 views 2 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