Creating a macro from a custom byline

Hi everyone,

I came across this add-on trying to create my own(Easy Heading Macro - Floating Table of Contents | Atlassian Marketplace). When using the add-on it creates a macro from a custom byline. Can anyone tell how its done? or where I can find information to read about it?

Kind regards,
Tim van Dantzig

I’m not sure exactly how the app you mentioned is built, but it might work something like this:

In the Byline Code:

  1. When the “Submit” button is clicked in the byline:
  2. Use the REST API to read the page content: Confluence REST API - Get Page.
  3. Modify the original page source by wrapping all the existing content in a two-column layout. The main content occupies the majority of the space, while the second column is much smaller.
  4. Insert your special macro into the second column.
  5. Save the updated page using the REST API: Confluence REST API - Update Page.

In the Macro Code:

  1. Read the content of the current page.
  2. Generate a Table of Contents (TOC) or any other content you want to display.
  3. Render the content accordingly.