Reuse Existing Macros

Some existing macros have many complex parameters, and you may want to get some standardization over their usage. Script macros provide an easy way to standardize parameters.

For example, the Table of Contents macro has many parameters. Use the following task as an example of re-using existing macro parameters:

  1. In a sample page, configure the Table of Contents macro parameters like you would want your users to.

  2. View the storage format of the page.

    To view the storage format, you need the Confluence Source Editor plugin.

  3. Copy the macro XHTML from the storage format, which should look similar to the following image:

  4. Create a new script macro with no body and no parameters.

  5. Add script to the macro, which should look similar to the following code:

    Include Bitbucket for Confluence: An error occured

    Failed to connect to Bitbucket. Check the Application Link for Bitbucket Data Center or the permissions of the app password for Bitbucket Cloud. Error details: 503:

    You must use the convertStorageToView method, as shown in the example code, to convert from storage format to HTML.

When you finish this task, the new macro uses the Table of Contents macro parameters.

For an example, view the Include All Child Pages example.