How can I embed another macro within the html macro?
Asked by Carissa Chan:

Hello there!

I have an html macro. Inside, there is a section tag followed by a script tag with some javascript to prompt a dialog box upon some trigger. Within the section tag I was hoping to reference the span macro created outside of the html macro. This span holds tabulated data whose rows are automated by Confluence as opposed to manually entering each via html syntax. The objective is to show a dialog box upon opening the page containing a question and this table. Thank you! This is my first post, so please advise if there is a better way to structure my problem.

![Screenshot 2021-08-20 150351.png](/t5/image/serverpage/image-id/157016i892DDA668BE12362/image-size/large?v=v2&px=999 "Screenshot 2021-08-20 150351.png")


Answers:
author: Shannon S
body: Hello Carissa,

Welcome to Atlassian Community, and thanks for raising this with us. It looks like you might be using a 3rd-party add-on to add the HTML and span macros since they're generally not supported in Confluence Cloud.

Can you let me know the name of the add-on you're using to make sure we give you the correct information?

Thank you!

Shannon

comments: author: Carissa Chan
body: Hi Shannon,

Sorry, I am pretty new to Confluence. By "add-on", do you mean the macro name? This is what I selected. Thank you!

![html-macro.png](https://community.atlassian.com/t5/image/serverpage/image-id/157185i0CF99EF900B9844F/image-size/large?v=v2&px=999 "html-macro.png")


author: Shannon S
body: Hi Carissa,

Thank you for the screenshot. That macro you circled looks like one we had in Confluence Cloud a few years ago but discontinued. The other macros with an orange icon (including the Span macro you're using) are by a third-party provider.

To answer your original question, I don't think it's possible to reference another macro from an HTML macro, but we'll need to confirm what version of that macro you're using to know for sure.

Can you confirm with me your Confluence version and that you are writing us about a Confluence Cloud instance and not a self-hosted server site?

Thank you!

Shannon


author: Carissa Chan
body: Hi Shannon, thanks for that information! How can I find which Confluence version I am using? It is likely that my company is using a self-hosted server site. If that is the case, what are the limits in terms of the HTML macro I am trying to use? And would there be an alternative? Thank you so much for your time and patience!


author: Carissa Chan
body: Oh, sorry, the version we are using is [Atlassian Confluence](http://www.atlassian.com/software/confluence) 7.10.2. Not sure if that was what you were asking for.


author: Shannon S
body: Hi Carissa,

Thank you for clarifying. That is precisely what I needed.

According to our [HTML macro documentation](https://confluence.atlassian.com/doc/html-macro-38273085.html), I don't see a documented way to reference other macros. While the HTML macro is ours, that particular span macro you're trying to reference is 3rd party macro. You might want to contact the vendor and see if they have any suggestions for you.

I found a few other threads that might give you some leads:

* <https://community.atlassian.com/t5/Confluence-questions/Calling-a-macro-from-another-macro/qaq-p/1116270>
* [https://community.atlassian.com/t5/Confluence-questions/HTML-Macro-manipulate-another-macro-s-result/qaq-p/1218269](https://community.atlassian.com/t5/Confluence-questions/HTML-Macro-manipulate-another-macro-s-result/qaq-p/1218269?)

Some suggestions are to use User Macros instead. If you still have trouble, you might even want to try [Atlassian Developer Community](https://community.developer.atlassian.com/). Your question is high-level so that you may find better success there.

I hope that helps!

Take care,

Shannon


author: Carissa Chan
body: Hi Shannon,

How do I filter out User Macros? Additionally, how will I know whether the macro is from a third-party?

Happy Learning!

Carissa


author: Shannon S
body: Hi Carissa,

We have a list that you can compare if you want to know if a macro came with Confluence or if your team installed it:

* [Macros in Confluence Server and Data Center](https://confluence.atlassian.com/doc/macros-139387.html)

[User Macros](https://confluence.atlassian.com/doc/writing-user-macros-4485.html) are a feature we included with the Server and Data Center versions of Confluence. It provides a way for your team to create custom macros. You supply the name for these macros, and you can add them like you would any other macro by typing its name.

I found a blog post that might help clarify things. We didn't write it at Atlassian, but I still find it very helpful.

[Confluence User Macros - An Introduction](https://tmcalm.nl/blog/confluence-user-macros-an-introduction/)

I hope that helps! :)

Take care,

Shannon


Tags: cloud

confluence-cloud

html

macro