How can I prevent an external link from overriding my classes?

Jake Burgy December 22, 2018

If I have a custom "button" macro with this body:

<a href="$paramLinkTarget" class="my-custom-button">$body</a>

And I enter "https://www.google.com/" for the LinkTarget parameter, this macro renders as follows:

<a class="external-link" href="https://www.google.com/" rel="nofollow">
Hello World
</a>

Where did my class name go?! Why is Confluence removing the custom CSS class from my macro?

Does this mean that I am unable to create a simple <a> button macro with a custom style on it?

I would prefer to know if there was an official way to disable this behavior. I do not want solutions that involve:

  • JavaScript workarounds/hacks
  • Putting the style inline using style="..." (not a best practice)

Thanks!

1 answer

0 votes
Calum June 17, 2021

Did you ever solve this? Been driving me potty all day trying to figure out a sensible workaround.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events