The Table of Contents macro scans the headings of the current Confluence page to dynamically create a table of contents from your page headings. This helps you navigate lengthy pages by summarising the content structure and providing links to headings. Headings are indented progressively.

On this page:

Usage with the Rich Text Editor

1. From the Rich Text Editor toolbar, select Insert, then select Table of Contents from the drop-down menu.
2. From the 'Insert 'Table of Contents' Macro' dialog box, select the required parameter values, then click 'insert' to add the table of contents to your page.

Usage with the Macro Browser

To insert the 'Table of Contents' macro into a page using the Macro Browser,

  1. Open your desired Confluence page or blog post, then click the 'Edit' button. The page or blog post opens in edit mode.
  2. Click the Macro Browser icon on the toolbar. The macro browser window opens in the middle of the screen in 'macro selection' mode.
  3. Scroll through the list of macros. Alternatively, start typing part of the name of your desired macro into the search box at the top right of the macro browser window. Macros with a matching name will appear in the main pane.
  4. Click on the desired macro to access its parameters and preview parameter changes ('preview mode').
  5. Set the macro parameters to your requirements. If desired, you can preview these changes by clicking 'Refresh'.
  6. Click 'Insert' to put the macro into the page.

(tick) You can also insert macros via autocomplete. For more information, see Using Autocomplete in the Rich Text Editor.

Once you've found the table of contents macro and have added the required parameter values, click 'insert' to add it to your page.

Usage with the Wiki Markup Editor

Include the following markup in your page:

{toc:type={[list,flat]|outline=[true,false]|style=[circle,square,disc,decimal,lower-roman]|indent=[5px]|minLevel=1|maxLevel=3}

There are more examples below.

マクロ パラメーター

Parameters are options that you can include in Confluence macros to control the content or format of the macro output. The table below lists relevant parameters for this macro.

Parameter names are different in the macro browser and in wiki markup. Below we show the macro browser parameter names in bold text, and the equivalent wiki markup parameters in (bracketed) text. If we do not show any parameter name for the wiki markup, then you should leave out the parameter name and simply include the parameter value as the first parameter, immediately after the colon (:).

パラメーター

必須かどうか

既定

説明

Output Type
(type)

いいえ

list

Set this to "list" or "flat".  Selecting list produces a typical list type TOC.  Selecting flat produces a horizontal menu-type series of links, for example: [Heading 1] [Heading 2] [Heading 3].

Display Section Numbering
(outline)

いいえ

false

Select the tick box to apply outline numbering to your headings, for example: 1.1, 1.2, 1.3.

List Style
(style)

いいえ

なし

Use this parameter to select the style of bullet point for each list item.  You can use any valid CSS style.  For example:

  • none — リスト スタイルの表示なし
  • circle — 丸のリスト スタイル
  • disc — the list style is a filled circle — this is the typical bullet list, and is the one we're using for this example list
  • square — 正方形のリスト スタイル
  • decimal — 番号付きリスト (1、2、3、4、5)
  • lower-alpha — the list is lower-case, alphabetised (a, b, c, d, e)
  • lower-roman — 小文字のローマ数字のリスト スタイル (i、ii、iii、iv、v、vi)
  • upper-roman — 大文字のローマ数字 (I、II、III、IV、V、VI) のリスト スタイル。

Separator
(separator)

いいえ

brackets

This parameter applies to "flat" lists only.  Use this parameter to style the display of a "flat" or horizontal list.  You can enter any of the following parameters:

  • brackets — 各アイテムは、角かっこ [ ] で囲まれます。
  • braces — 各項目をかっこ { } で囲む。
  • parens — 各アイテムをかっこ ( ) で囲む。
  • pipe — 各アイテムをパイプで区切る。
  • anything — Each is separated by the value you enter. You can enter any text as a separator, for example "***". If using a custom separator, be aware that text displays exactly as entered, with no additional white space to further separate the characters.

Indent

いいえ

 

Use this parameter to style the indent for a "list" according to CSS quantities, entering "10px" will successively indent list heading groups 10px. For example, h1 headings will be indented 10px and h2 headings will be indented an additional 10px.

Minimum Heading Level
(minLevel)

いいえ

1

Use this parameter to select the heading level to start your TOC  list.  For example, 2 will list h2, h3, and h4 headings, but will not include h1 headings.

Maximum Heading Level
(maxLevel)

いいえ

7

Use this parameter to select the maximum heading levels to include.  For example, 2 will list h1 and h2, but will not include h3 and below.

Include Headings
(include)

いいえ

 

Use this parameter as a way of filtering to include headings according to specific criteria. You can use wildcard characters to filter the headings. See Sun's Regex documentation for examples of constructing regular expression strings.

Because '|' is the macro parameter separator, use a comma ',' where you would normally use a '|'. If you need to match a comma, use its escape code: 'x2c'.


Exclude Headings
(exclude)

いいえ

 

Use this parameter as a way of filtering to enclude headings according to specific criteria. You can use wildcard characters to filter the headings. See Sun's Regex documentation for examples of constructing regular expression strings.

Because '|' is the macro parameter separator, use a comma ',' where you would normally use a '|'. If you need to match a comma, use its escape code: 'x2c'.


Printable
(printable)

いいえ

true

By default, the TOC is set to print. If you set this parameter to false, the TOC will not be visible when you print the page.

CSS Class Name
(class)

いいえ

 

If you have a custom TOC in your CSS style sheet, you can use this parameter to output the TOC with the specified "class" attribute.

この例は、次のヘッダーが付いたページに基づいています。

h1. Places
h2. Favourite Places
h2. Unknown Places
h1. Foods
h2. Favourite Foods
h2. Unknown Foods
h1. Things
h2. Favourite Things
h2. Unknown Things

Basic Table of Contents

This will display all level 1 and level 2 headings as numbered lists.

{toc:style=decimal|maxLevel=2}

Screenshot: Basic TOC example

フィルターされた目次

This will filter all headings to include those that contain "Favourite", but will exclude any heading which ends with the word "Things'. The list is styled with Roman numerals. It will not display on the printed page.

{toc:style=upper-roman|indent=10px|maxLevel=2|include=Favourite.*|exclude=.*Things|printable=false}

Screenshot: Filtered TOC example

フラット リスト

This will filter all headings to render a flat list of 'Unknowns' enclosed in square brackets.

{toc:type=flat|maxLevel=2|include=Unknown.*}

Screenshot: TOC displayed as flat list

注意

  • Due to an outstanding issue in the Table of Contents macro (CONF-10619), the Macro Browser's Refresh function does not render any parameter modifications. Currently, the rendering of parameter value modifications to the Table of Contents macro occurs only after the page is saved.
  • Using HTML Heading Markup with the Table of Contents Macro — The Table of Contents macro cannot handle HTML heading markup on its own. Hence, if you used the HTML and HTML Include macros to render HTML heading markup in a Confluence page, the Table of Contents macro will not create a contents list out of these headings. (For more information on about this issue, please refer to TOC-93.)
    However, if you insert an HTML anchor into each HTML heading on your page (based on the following syntax), the Table of Contents macro will incorporate these headings into your contents list.
    <h2><a name="pagename-headingname"></a>見出し名</h2>
    The syntax for the anchor name is usually the page name and heading name separated by a hyphen, in which the page and heading names have all spaces removed and are converted to lowercase. If punctuation marks occur within a page or heading name, each mark should usually be converted to its URL escape code in the anchor name.
関連トピック

Table of Contents Zone Macro
Pagetree Macro
Adding a Navigation Sidebar
Working with Macros

Take me back to the Confluence User's Guide.