Access Keys:
Skip to content (Access Key - 0)

toc macro

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:
  • list (default) - a hierarchical list of links to headings
  • flat - a flattened (single line) list
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:
  • none - no marker
  • Any valid CSS style (see the Styles tab above)
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:
  • brackets (default) - items will be enclosed in \square \brackets
  • brace - items will be enclosed in {curly} {braces}
  • parens - items will be enclosed in (normal) (brackets)
  • pipe - items will be separated | by | pipes
  • Anything else - a custom separator
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:
  • Item 1
  • Item 2
  • Item 3
  • Item 4
circle:
  • Item 1
  • Item 2
  • Item 3
  • Item 4
square:
  • Item 1
  • Item 2
  • Item 3
  • Item 4
decimal:
  • Item 1
  • Item 2
  • Item 3
  • Item 4
decimal-leading-zero:
  • Item 1
  • Item 2
  • Item 3
  • Item 4
lower-roman:
  • Item 1
  • Item 2
  • Item 3
  • Item 4
upper-roman:
  • Item 1
  • Item 2
  • Item 3
  • Item 4
lower-alpha:
  • Item 1
  • Item 2
  • Item 3
  • Item 4
upper-alpha:
  • Item 1
  • Item 2
  • Item 3
  • Item 4
lower-greek:
  • Item 1
  • Item 2
  • Item 3
  • Item 4
lower-latin:
  • Item 1
  • Item 2
  • Item 3
  • Item 4
upper-latin:
  • Item 1
  • Item 2
  • Item 3
  • Item 4
hebrew:
  • Item 1
  • Item 2
  • Item 3
  • Item 4
armenian:
  • Item 1
  • Item 2
  • Item 3
  • Item 4
georgian:
  • Item 1
  • Item 2
  • Item 3
  • Item 4
cjk-ideographic:
  • Item 1
  • Item 2
  • Item 3
  • Item 4
hiragana:
  • Item 1
  • Item 2
  • Item 3
  • Item 4
katakana:
  • Item 1
  • Item 2
  • Item 3
  • Item 4
hiragana-iroha:
  • Item 1
  • Item 2
  • Item 3
  • Item 4
katakana-iroha:
  • Item 1
  • Item 2
  • Item 3
  • Item 4

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

See Also



Ask questions, get help and report bugs & issues on our Community Site

View old comments


Adaptavist Theme Builder Powered by Atlassian Confluence