This is a Tampermonkey userscript that adds a heading numbering feature to the page editor in Atlassian Confluence. This will number headings as follows:
1. Header 1
1.2 Header 2
1.2.3 Header 3
2. Header 1
Based on work by Markus Jenu at https://community.atlassian.com/t5/Confluence-questions/Is-it-possible-to-add-numbering-to-headings-in-Confluence/qaq-p/315517#M87046.
The original script was intended to be installed as a Confluence user macro. Adding macros requires admin rights to your Confluence instance. This script allows non-admin users to run this script locally.
- Install the Tampermonkey extension for your web browser.
- Add Confluence Auto Numbered Headings to Tampermonkey from its home on Greasy Fork using the "Install this script" button. (The script you see here on GitHub auto-syncs to Greasy Fork.)
- Configure this script in Tampermonkey, if needed (see below).
- Edit any page in confluence. Add heading numbers using the new button shown in the screenshot:
This script is pre-configured to work with Confluence instances hosted by Atlassian. If you run an internal / on-premises instance of Confluence, you'll need to change the script's settings in Tampermonkey as follows:
- Go to Tampermonkey > Dashboard.
- Under the "Installed userscripts" tab, click on the edit icon for Confluence Auto Numbered Headings.
- Click on the "Settings" tab.
- Under "Includes/Excludes" > "User matches", add the URL for your internal Confluence instance. The format should be something like https://confluence.companyintranet.com/*
- 2020-03-18 v0.4: Fixed a bug in which extra text was added to the end of headings that contained HTML. For example,
<h3>Example <strong>Heading</strong></h3>
would be changed to<h3>1.3 Example Heading <strong>Heading</strong></h3>
. - 2020-03-20 v0.5: Fixed a bug in which the button failed to appear when creating a new page.
- 2021-03-29 v0.6: Made compatible with Atlassian's new ProseMirror-based editor.
- 2022-07-14 v0.7: Fixed issue in which dependency that was deleted from GreasyFork (WaitForKeyElements) prevented this script from loading.
Hey @csuka: This is intended to be used with the Tampermonkey browser plugin, which must be installed locally for every user. Tampermonkey is available for all major browsers. Once that's installed, you can install this script from its home on the Greasy Fork userscript repository.