Cannot use css selectors in user macro

Paul Fennema April 19, 2020

I'd like to overwrite some styles and need to use a css selector to select the direct descendant and hence I need to use something like:

<style type="text/css">

table.aui > tbody > th > td etc

</style>

However when rendering the macro the '>'  is replaced by &gt; and hence the selector does not work. 

I already tried to include in my own user macro the html macro but that does not work either:

<ac:structured-macro ac:name="html">
<ac:plain-text-body><![CDATA[
<style type="text/css">
table.aui>tbody>tr> td { padding: 4px 10px !important; } // Make rows narrow
table.aui>tbody>tr> th { white-space: nowrap; color: green; } // Don't let header title wrap
table.aui>tbody>tr>td:not(:last-child) { white-space: nowrap; color: red; } // nowrap for all non-last col
table.aui>tbody>tr>th:last-child { width: 50% !important; } // Expand last col to fit rest of width
table.aui>tbody>tr.rowAlternate { background: #F3F5F7 !important; } // Zebra stripes
</style>
]]>
</ac:plain-text-body>
</ac:structured-macro>

The selector (>) is still replaced by the &gt;

Note that the html macro is enabled (i'm admin).

Does anyone has an idea to use selectors in user macros for css styling?

Regards, Paul Fennema

 

 

1 answer

1 accepted

0 votes
Answer accepted
Dominic Lagger
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.
April 25, 2020

Hi @Paul Fennema 

Since I create user macros I have this problem and have not found a solution yet.

But here are some workarounds (Source: This answer from Bill):

  1. Add your formatting inline with your macro code
  2. Add a style sheet to your user macro
  3. Add custom class names or ID to your user macro code. Then add custom CSS to the global/space style sheet.

Regards, Dominic

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events