Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Possible workaround for missing div and span macros?

Steffen Heller
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.
January 26, 2021

Hello,

I have been heavily using the div and span macro for all kinds of self-created CSS styles for my PDF exports (page breaks, background colours, running headlines, pages in landscape mode, ...).

As I am still working on a very old Confluence version (4.3.7), this hasn't been a problem so far. But, as I have learned, in newer version these macros will be missing.

So, how can I make sure that I can still use all these styles for old and new pages? How can I still include div and span in my Confluence pages?

Here is my very simple idea:

I include them in the page's html code with the Firefox developer tools.
For my page breaks I would add "<div class="pagebreak">...</div>" as an example.

When I try this in my Confluence pages now, it seems to work with no problem.

But reading some of the feedback pages about the macro removals like https://jira.atlassian.com/browse/CONFCLOUD-65774?error=login_required&error_description=Login+required&state=95f7e532-0a60-4a12-96fb-72653153bd69 I there doesn't seem to be any hint about this possibility.

Am I missing something and this will not work in newer Confluence version?

2 answers

0 votes
Bill Bailey
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.
January 26, 2021

The most rock-solid way is the create a user macro that wraps you content in these tags. I know I have used it in classed p div tags as last as version 6.13.8

Steffen Heller
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.
January 29, 2021

Can you post your code? Are there other up-to-date places where people exchange user macros?
I had the impression that the div and span macro is missed by many but don't seem to find much information about what people do about it.

Bill Bailey
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.
January 29, 2021

Along the lines of teaching someone to fish rather than giving them a fish ;-) There is the link to the basics:

writing-user-macros 

And there is a no-print example macro that uses a div tag exactly the way you would need to do it for you needs.

The color as size example below it shows an example with span tags.

Enjoy!

0 votes
Steffen Heller
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.
January 26, 2021

As an alternative thought (yet again an idea that I can't verify myself):

Including the div macro the old way with Insert > Other macros, the html code that is actually inserted in the page's "Edit" mode source code seems to be this:

<table class="wysiwyg-macro" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2RpdjppZD10ZXN0fQ&amp;locale=de_DE&amp;version=2); background-repeat: no-repeat;" data-macro-name="div" data-macro-parameters="id=test" data-macro-body-type="RICH_TEXT" data-mce-style="background-image: url('http://lightweb.zumtobelgroup.com/plugins/servlet/confluence/placeholder/macro-heading?definition=e2RpdjppZD10ZXN0fQ&amp;locale=de_DE&amp;version=2'); background-repeat: no-repeat;"><tbody><tr><td class="wysiwyg-macro-body"><p>divtest</p></td></tr></tbody></table>

Stripping that down to its essential would be this and also seems to work ("id=test" and the content "divtest" can be replaced with other names):

<table class="wysiwyg-macro" data-macro-name="div" data-macro-parameters="id=test" data-macro-body-type="RICH_TEXT"><tr><td class="wysiwyg-macro-body"><p>divtest</p></td></tr></table>

I am not familiar at all with user macros but doesn't that look like the formula that could be used as a starting point for a user macro?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events