Replace "Numbered Headings" Macro with User Macro - retaining content
Asked by Thorsten Vieten:

Hi Community!

We have been using the free version of the "Numbered Headings" macro a lot. Now that the most recent versions have moved to a paid model, we would like to stop using the macro.

Is there any way you know that we can replace the macro with a same-called user macro and retaining the content?

My tests in our test environment allowed me to replace the macro so that the pages were VISIBLE (view mode). But as soon as I was hitting edit mode, there was only a blank page and all content lost.

Any ideas would be highly appreciated.

Many thanks in advance,

Thorsten


Answers:
author: Thorsten Vieten
body: What we ended up doing was:

1. Upgrade the system to the latest version (i.e. beyond 7.8, which introduced "Disabled macros will preserve your content"
2. Follow this KB article [How to bulk update Confluence content through the database to replace old macros with new ones \| Confluence \| Atlassian Documentation](https://confluence.atlassian.com/confkb/how-to-bulk-update-confluence-content-through-the-database-to-replace-old-macros-with-new-ones-1018780615.html)

Problem solved.


author: A B
body: I worked around this by adding the following to custom HTML:

```
AJS.$(document).ready(function() {
  if (!AJS.clone)
    AJS.clone = e => { e = AJS.$(e); if (e.length) return AJS.$.clone(e); return AJS.$(); };
});
```

comments: author: Thorsten Vieten
body: Interesting option, thanks Adam! What is AJS?


author: Nicolas Casel
body: AJS is an object which allows Confluence to update DOM elements via HTML and Javascript code.


author: Nicolas Casel
body: Thanks [@Adam Butcher](/t5/user/viewprofilepage/user-id/682748)

How is it supposed to work? I guess I have to insert this JS code within the page containing the Numbered Headings macro, and then: should I disable the macro or let it enabled? In both cases I do not get successful outcome.


author: abutcher
body: Add it within a style block in your site's Custom HTML (at the end of HEAD). If you don't have admin rights on the server, you would have to ask your admin to do it. The config page is /confluence/admin/editcustomhtml.action at your server (assuming a /confluence/ context path; drop that if you are going direct to the port).

However, there appears to be a more "supported" way to still use the free version according to [the comment below](https://community.atlassian.com/t5/Confluence-questions/Re-Replace-quot-Numbered-Headings-quot-Macro-with-User-Macro-r/qaq-p/1691155/comment-id/209085#M209085). Maybe go via that avenue if you want an official solution.


author: Gert-Jan van de Streek
body: Echoing [@Adam Butcher](/t5/user/viewprofilepage/user-id/682748) , Numbered Headings was created as an app to fill a gapp, not leave you with another problem. We will help you solve this without the combersome workaround. Please contact us via support.


author: Nicolas Casel
body: Thanks [@abutcher](/t5/user/viewprofilepage/user-id/1071198) , but it does not work better (I can't see any impact).

[@Gert-Jan van de Streek](/t5/user/viewprofilepage/user-id/527858) , yes I will contact your Support Team (we were already in contact some months ago).


author: Gert-Jan van de Streek
body: We have communicated to all customers that have been on the free version for a long time how they can keep making use of that functionality. If you missed that, feel free to reach out to our support and we'll help you out. There is no need to workaround this.

comments: author: Thorsten Vieten
body: That ship has sailed :)


author: Gert-Jan van de Streek
body: You know where the harbor is. We're there to help, any time.


author: tobias.kritten
body: Hi [@Gert-Jan van de Streek](/t5/user/viewprofilepage/user-id/527858) , we are using the free macro for quite a long time and are migrating to cloud. How can we either continue using the free version or remove the macro wrapper around the content?


author: Gert-Jan van de Streek
body: Please contact support, you can find links to email or service desk via via [https://marketplace.atlassian.com/apps/16063/numbered-headings?tab=support\&hosting=cloud](https://marketplace.atlassian.com/apps/16063/numbered-headings?tab=support&hosting=cloud)


author: tobias.kritten
body: [@Gert-Jan van de Streek](/t5/user/viewprofilepage/user-id/527858) Your support really **not** wants to help ;-) Could you please have a look at SUPPORT-174882? It seems you are neither offering a free cloud version nor any help with removing the macro.


author: tobias.kritten
body: [@Gert-Jan van de Streek](/t5/user/viewprofilepage/user-id/527858) just got final confirmation your support won't be able to help. We have to change all pages/macros manually on every page. Was that the intended outcome when you asked me to open a case?


author: Gert-Jan van de Streek
body: It is always my intend to help, I have sent you a pm so we can take this offline.


Tags: atl-adm

atl-dev

atlassian-marketplace

confluence-server

content

macro

numbered-heading

user-macro