Access Keys:
Skip to content (Access Key - 0)
Home (Access Key - 1)
All spaces... (Access Key - 3)
Log in (Access Key - 5)
Sign up (Access Key - 6)
Toggle Sidebar

toc macro


{toc} Macro

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:
h2.This heading won't appear
h2. This heading will appear
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.
Toggle Sidebar

See Also

Incoming Links


Outgoing Links


Added by Guy Fraser on Oct 17, 2005 10:43, last edited by Guy Fraser on Jul 21, 2008 19:13
Anonymous

Hi,

is there a way to create a toc for a page-family or a whole space?

Cheers,
Eike

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.

Anonymous

That sounds like fun. I guess I give it a try.

Thanx,
Eike

Anonymous

With outline=true the toc is numbered but the corresponging headings are not, how can this be done.

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...

Anonymous

Auto-numbering of headings would be excellent...

Anonymous

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

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

Anonymous

Command I'm trying:

{toc:style=square|includePages=true}

Utilities jar: utilities-plugin-2.1.3.jar

If you omit the "includePages" do you still get the error?

View the rest of this thread  |  2 more comments by 2 persons
Anonymous

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

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.



Updated by Volker Schneider
May 10, 2008 14:48

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.



Updated by Greg Pendlebury
May 21, 2008 03:25

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?

Seems like Confluence 2.7 just got a bug with the reporting plugin. I am experience similar error as Greg when rendering

Unknown macro: {report-info}
. The error message reads, "Error formatting macro: report-info: org.randombits.confluence.intercom.FacadeException: java.lang.reflect.InvocationTargetException."

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

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.

Link generated by TOC in same page (works) http://server/kb/display/conf/FAQ+-+Access#FAQ-Access-CanonlyseeConfluence%2FJira%2FDemonstrationspaces%3F
Link generated by embedded report TOC (broken, wrong page) http://server/kb/display/conf/FAQ#FAQ-Access-CanonlyseeConfluence%2FJira%2FDemonstrationspaces%3F

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?

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.)


Adaptavist Theme Builder Powered by Atlassian Confluence