The {toc} was originally developed by CustomWare but is now maintained by Atlassian. It displays a table of contents based on headings present on the page...
If you have a lot of information on a page, it's a good idea to break it in to sections by using Headings in order to make it more readable. You can then use this macro to display a contents list based on those headings.
Parameters:
The {toc} macro has the following parameters:
{toc:parameters}
| Parameter | Required | Default | Notes |
|---|---|---|---|
| type | list | The type of output, either:
|
|
| class | An optional CSS class to associate the table with. If specified, no other formatting information will be used (style, indent, etc) allowing you full control over the display. | ||
| style | The style of bullet point to use for each item when using the list type:
|
||
| indent | 10px | When using the list type, this parameter set the indentation to use for each nested level of the contents. Any valid CSS size value can be used, but remember to specify the units (e.g. "px" for pixels). | |
| separator | brackets | When using the flat type, this parameter defines how individual items will be separated from one another:
|
|
| minLevel | 1 | The minimum heading level to include in contents list - a number between 1 and 6 corresponding to the heading level. Must be less than or equal to the "maxLevel" parameter. | |
| maxLevel | 6 | The maximum heading level to include in contents list - a number between 1 and 6 corresponding to the heading level. Must be greater than or equal to the "minLevel" parameter. | |
| includePages | false | If set to true, then the contents will also include any headings within included pages within the current page. | |
| filter | Allows you to use a Regular Expression to filter headings based on matching criteria. Not for the feint hearted! | ||
| printable | true | If set to false the table of contents will not be displayed in a print preview. | |
| outline | false | If set to true, items will be uniquely numbered in a 1.2.3 style. |
The following chart shows examples of the CSS styles that can be used and how they look in your own web browser:
disc:
|
lower-roman:
|
lower-latin:
|
cjk-ideographic:
|
The first two columns above are the most widely supported styles. The other styles generally require an operating system and web browser both capable of rendering Unicode characters.
Correct Styles:
The following chart shows what the styles should look like if everything is configured properly:

Style Faults:
The following chart shows what the styles often look like on systems that don't have full unicode support:
Examples:
Hints and Tips
Wherever applicable, you should set the "printable" parameter to false if you have set the "type" parameter to flat - flat contents lists are normally only useful as navigation shortcuts to specific headings and as such there's no point in printing them out.
Frequently Asked Questions
| Q | I've got headings on the page, but some of them are not appearing in the contents? |
|---|---|
| A | Make sure you've got a space after the h1. and the actual heading: |
| Q | How do you get those four dots as the custom separator? |
|---|---|
| A | It's just two sets of colons ":" next to each other to give :: |
| Q | Can I split the table of contents in to smaller chunks throughout my page? |
|---|---|
| A | Yes. Use the toc-zone macro. |
.png)








Comments (28)
Mar 08, 2006
Anonymous says:
Hi, is there a way to create a toc for a page-family or a whole space? Cheers,...Hi,
is there a way to create a toc for a page-family or a whole space?
Cheers,
Eike
Mar 08, 2006
Guy Fraser says:
The closest thing to that at present is the children macro but that will only li...The closest thing to that at present is the children macro but that will only list the page titles. Another alternative is the pagetree macro which again lists page titles.
It is in theory possible to mix the Metadata Plugin and the toc macro - add a toc as metadata to each page, label the page with something unique then use the various report macros to list all pages with the specific label and render out their individual toc's. Sounds hairy, but if you are desperate that's the only option I can think of at present.
Mar 09, 2006
Anonymous says:
That sounds like fun. I guess I give it a try. Thanx, EikeThat sounds like fun. I guess I give it a try.
Thanx,
Eike
Mar 18, 2006
Anonymous says:
With outline=true the toc is numbered but the corresponging headings are not, ho...With outline=true the toc is numbered but the corresponging headings are not, how can this be done.
Mar 18, 2006
Guy Fraser says:
Unfortunately it's not possible at present to auto-number the headings on the pa...Unfortunately it's not possible at present to auto-number the headings on the page. We tried creating a style sheet to do this but it only worked in the Opera browser and caused problems with other browsers which was a pity.
I'll see if we can conjure up a plugin that would number headings...
Mar 23, 2006
Anonymous says:
Auto-numbering of headings would be excellent...Auto-numbering of headings would be excellent...
Jan 20, 2010
Gert-Jan van de Streek says:
Numbered headings are now available in Confluence by using the "Numbered Heading...Numbered headings are now available in Confluence by using the "Numbered Headings" plugin!
More info: https://plugins.atlassian.com/plugin/details/16063
Documentation: https://studio.plugins.atlassian.com/wiki/display/NUMHEAD/Home
The plugin is also available from the plugin repository inside Confluence.
Plus: the numbering is preserved in PDF exports.
Guy, we should meet up and discuss how toc and numberedheadings go together. Both of the plugins at least should agree on the numbering scheme.
Mar 26, 2006
Anonymous says:
If I try: Error formatting macro: toc: java.lang.NoSuchMethodError: com.atlass...If I try:
Error formatting macro: toc: java.lang.NoSuchMethodError: com.atlassian.confluence.renderer.v2.macros.PageIncludeMacro.setSpacePermissionManager(Lcom/atlassian/confluence/security/SpacePermissionManager;)V
This is with Confluence 2.1.4 Build:#410
And TOC toc-plugin-1.4.7.jar
Mar 26, 2006
Guy Fraser says:
It's critical that you are using the correct version of the Utilities plugin - t...It's critical that you are using the correct version of the Utilities plugin - there have been some updates to this plugin recently and there are three versions of it - one for 1.4.x, one for 2.0.x and one for 2.1.x - if you've got the wrong versions installed, they will break because Atlassian changed the user management system in 2.1.
Adaptavist have been busy working on solutions to these problems and we hope to have several of our patches incorporated in to Confluence 2.2. This will enable plugin authors to package required libraries inside their plugin so you won't need to install Utilities plugin separately any more
Mar 26, 2006
Anonymous says:
Command I'm trying: {toc:style=square|includePages=true} Utilities jar: util...Command I'm trying:
{toc:style=square|includePages=true}Utilities jar: utilities-plugin-2.1.3.jar
Mar 26, 2006
Guy Fraser says:
If you omit the "includePages" do you still get the error?If you omit the "includePages" do you still get the error?
Mar 27, 2006
Anonymous says:
Nope.Nope.
Mar 27, 2006
Guy Fraser says:
Sounds like a bug - I've reported it in JIRA: http://jira.adaptavist.com/browse...Sounds like a bug - I've reported it in JIRA:
http://jira.adaptavist.com/browse/TOC-13
Jun 30, 2006
Anonymous says:
Hi, The line "h1. " leads to a crash of the whole application server: (java.lan...Hi,
The line "h1. " leads to a crash of the whole application server: (java.lang.OutOfMemoryError: Java heap space). I think the toc macro runs in an infinite loop.
I know this line makes no sence, but it happend twice a month that a user enter such a line.
We are using confluence 2.1.4.410.
cu,
Tobias
Mar 16, 2008
Sam Peascod says:
I'd really like to see a "from here down"-type parameter in the toc macro. I fi...I'd really like to see a "from here down"-type parameter in the toc macro. I find I often put headings before the table of contents (such as "h2. Table of Contents") which, though at the same level as subsequent headings, shouldn't be included in the ToC. It would be useful if the ToC could be configured to link/hierarchise only those headings below the ToC itself. Granted, I can use the toc-zone macro as a workaround, but feel such a parameter on would be cleaner. I tried using the first FAQ to my advantage here, but it seems to know how to work around that issue now.
May 10, 2008
Volker Schneider says:
Hi, I'd like to have a list of the main headlings of a page ... but cannot comb...Hi,
I'd like to have a list of the main headlings of a page ... but cannot combine "report+toc":
1) A list of children I generate with ...only 1x {...
{{report-table}
{{local-reporter:content:children|depth=all}
{{text-sort:content:title|mode=natural|order=ascending}
{{local-reporter}
{{report-column:title=Nachfolgende Seiten|width=800px}
{{report-info:content:title|link=true}
{{report-column}
{{report-table}
2) I would like to use {{toc:maxLevel=1|style=none|outline=true|link=true}
I appreciate your help.
May 21, 2008
Greg Pendlebury says:
I'm just using a plain toc line with no parameters, but get this error. Error...I'm just using a plain toc line with no parameters, but get this error.
Error formatting macro: toc: java.lang.NoSuchMethodError: org.w3c.tidy.Tidy.parse(Ljava/io/Reader;Ljava/io/Writer;)Lorg/w3c/tidy/Node;
We're on 2.4.4
Anybody know what could be going on?
Jun 03, 2008
Shaji Khan says:
Seems like Confluence 2.7 just got a bug with the reporting plugin. I am experie...Seems like Confluence 2.7 just got a bug with the reporting plugin. I am experience similar error as Greg when rendering Re: toc macro. The error message reads, "Error formatting macro: report-info: org.randombits.confluence.intercom.FacadeException: java.lang.reflect.InvocationTargetException."
Jun 23, 2008
David Jaramillo says:
I am experiencing problems when generating a TOC from a consolidation page "cons...I am experiencing problems when generating a TOC from a consolidation page "consolidated document", which has been created using {include} for each section.
For avoiding redundancy and ensuring consistency between page titles and headings, the heading of each page is created like this:
h1. {page-info:title}
The TOC macro in the consolidated page is used like this:
{toc:includePages=true|style=none|maxLevel=3|indent=15px|printable=false}
The resulting TOC is:
1 consolidated document
1.2 consolidated document
1.3 consolidated document
2 consolidated document
2.2 consolidated document
3.3 consolidated document
...
Which is not the desired result.
Is there a possibility to tell the TOC macro to use the headings as they are actually rendered?
Any help would be greatly appreciated !!
David
Jun 25, 2008
Andy Brook says:
I've got the following report almost working, it reports sub-pages, and generate...I've got the following report almost working, it reports sub-pages, and generates a TOC for each in a report column. The problem is that the link's in the TOC output don't work. The sub-pages themselves do inlclude a TOC at the top of the pages in which the links work.
The report generated TOC link seems to omit the actual target page...
Here is the example report I used:
{report-table} {content-reporter:type=page|scope=@self>children} {text-sort:content:title|order=ascending} {content-reporter} {report-column:title=Category|width=150px}{report-info:content:title|link=true} {color:#909090}{report-info:content:excerpt}{color}{report-column} {report-column:title=Topics|width=400px}{toc:outline=true|link=true|indent=0px}{report-column} {report-column:title=Last Modifier}{report-info:content:modifier|link=true}{report-column} {report-column:title=Updated}{report-info:content:modification date|format=dd MMM @ h:mm a}{report-column} {report-column:title=Comments}{report-info:content:all comments > collection:size}{report-column} {report-column:title=Page Labels}{report-info:content:labels|link=true}{report-column} {report-table}Any pointers on how to fix?
Jul 01, 2008
Guang H. Rong says:
Hi, once you created a table of contents by using {toc}, how to create a show/hi...Hi, once you created a table of contents by using {toc}, how to create a show/hide link to show/hide the table of contents by clicking on the link? (similar to show/hide comments.)
Feb 06, 2009
Edward Tam says:
I get this error when I try to used the deck macro along with the toc. Error fo...I get this error when I try to used the deck macro along with the toc.
Error formatting macro: toc: java.lang.IllegalStateException: No match available
It doesn't seem like the 2 will work together on the same page? As soon as I remove the deck it works fine. any suggestions how I can get around this?
Thanks
ah works better with toc zone macro
Dec 16, 2009
Carrie Moley says:
Is it possible to get the toc links working in the PDF output so that clicking t...Is it possible to get the toc links working in the PDF output so that clicking the toc entries in the PDF take you to that section of the document?
Thanks,
Carrie
May 11, 2010
Clinton Green says:
Can anyone advise how it might be possible to use a carriage return as a separat...Can anyone advise how it might be possible to use a carriage return as a separator in a TOC? separator=newline works OK, but I need an extra line break.
Aug 17, 2010
Thijs says:
I've just added a table of contents to some pages which are dynamically generate...I've just added a table of contents to some pages which are dynamically generated (one by the reporting plugin, and the other using includes). I'm happy t say that all works fine, and headings are properly extracted from the dynamic content. However I noticed that if I edit one of the heading on an included (or reported on) page, the table of contents is not updatedt. I suspect this has to do with caching, because the toc is only updated after make a minor edit of the page that contains the toc (and not the page with the content, the one that is included). Anyway i can solve this and force the toc to update after an included page has been edited?
Jul 04, 2011
Jose Maria Cubel says:
I have the same problem. I have included a toc macro inside a user macro. First ...I have the same problem. I have included a toc macro inside a user macro. First render works ok but when I edit the page no changes are applyed to the page.
I have tried to update toc macro surrounding it with the cache macro. No success
Any idea?
Feb 14, 2011
Devu says:
Confluence 3.2 I see on few pages the toc does not take me to the proper links, ...Confluence 3.2 I see on few pages the toc does not take me to the proper links, any pointers hints pls
Thanks!!
Mar 15, 2011
Dzmitry Zenin says:
Hi, currently toc plugin builds table based on headers. Imaging such situation: ...Hi, currently toc plugin builds table based on headers. Imaging such situation:
h1. How to do action
h2. in v1 of application
h2. in v2 of application
h1. How to do action2
h2. in v1 of application
h2. in v2 of application
I have 2 h2 headers under different h1 headers. But they have same name. So in table of contents i will have them but all links with name "in v1 of application" will point to one first header with this name.
How i can resolve this situation and make links point to the headers under appropriate h1 headers.
Thx