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:
- When the “Submit” button is clicked in the byline:
- Use the REST API to read the page content: Confluence REST API - Get Page.
- 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.
- Insert your special macro into the second column.
- Save the updated page using the REST API: Confluence REST API - Update Page.
In the Macro Code:
- Read the content of the current page.
- Generate a Table of Contents (TOC) or any other content you want to display.
- Render the content accordingly.