Documentation for Confluence 5.4.
Documentation for Confluence OnDemand and earlier versions of Confluence is available too.

Skip to end of metadata
Go to start of metadata

The Table of Contents macro scans the headings on the current Confluence page to create a table of contents based on those headings. This helps readers find their way around lengthy pages, by summarising the content structure and providing links to headings.

Using the Table of Contents macro

Hint: For quick access from the editor toolbar, choose Insert > Table of Contents.

To add the Table of Contents macro to a page:

  1. In the Confluence editor, choose Insert > Other Macros.
  2. Find and select the required macro.

Speeding up macro entry with autocomplete: Type { and the beginning of the macro name, to see a list of suggested macros. Details are in Using Autocomplete.

To edit an existing macro: Click the macro placeholder and choose Edit. A macro dialog window will open, where you can edit the parameters of the macro.

Macro parameters

Parameters are options that you can set to control the content or format of the macro output. Where the parameter name used in Confluence storage format or wikimarkup is different to the label used in the macro browser, it will be listed below in brackets (example).

Parameter

Default

Description

Output Type
(type)

list

  • list — produces a typical list-type table of contents.
  • flat — produces a horizontal menu-type series of links.

Display Section Numbering
(outline

clear

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

List Style
(style

disc

Select the style of bullet point for each list item.  You can use any valid CSS style.  For example:

  • none — no list style is displayed
  • circle —  the list style is a circle
  • disc — the list style is a filled circle. This is the typical bullet list, and is used for this example list.
  • square — the list style is a square
  • decimal — the list is numbered (1, 2, 3, 4, 5)
  • lower-alpha — the list is lower-case, alphabetised (a, b, c, d, e)
  • lower-roman — the list style is lower roman numerals (i, ii, iii, iv, v, vi)
  • upper-roman — the list style is upper roman numerals (I, II, III, IV, V, VI)

Heading Indent
(indent

 

Sets the indent for a list according to CSS quantities. Entering 10px will successively indent heading groups by 10px. For example, level 1 headings will be indented 10px and level 2 headings will be indented an additional 10px.

Separator
(separator

brackets

This parameter applies to flat lists only.  You can enter any of the following values:

  • brackets — Each item is enclosed by square brackets: [ ].
  • braces — Each item is enclosed by braces: { }.
  • parens — Each item is enclosed by parentheses: ( ).
  • pipe — Each item is separated by a pipe:
  • anything — Each item 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.

Minimum Heading Level
(minLevel

1

Select the highest heading level to start your TOC  list.  For example, entering 2 will include levels 2, and lower, headings, but will not include level 1 headings.

Maximum Heading Level
(maxLevel

7

Select the lowest heading level to include.  For example, entering 2 will include levels 1 and 2, but will not include level 3 headings and below.

Include Headings
(include

 

Filter headings to include according to specific criteria. You can use wildcard characters. See Sun's Regex documentation for examples of constructing regular expression strings.

 

Exclude Headings
(exclude

 

Filter headings to enclude according to specific criteria. You can use wildcard characters. See Sun's Regex documentation for examples of constructing regular expression strings.

 

Printable
(printable

checked

By default, the TOC is set to print. If you clear the check box, the TOC will not be visible when you print the page.

CSS Class Name
(class

 

If you have custom TOC styles in your CSS style sheet, use this parameter to output the TOC inside <div> tags with the specified class attribute.

Examples

The examples below are based on this table of contents:

Filtered Table of Contents

This example filters the headings to include those that contain 'Favourite', but excludes headings which end with 'Things'. The list is styled with Roman numerals.

ParameterValue
List Styleupper-roman
Include Headings
Favourite.*
Exclude Headings
.*Things

The resulting table of contents is:

Flat List

This example filters all headings to render a flat list of 'Unknowns' enclosed in square brackets (the default list style).

ParameterValue
Output Type
flat
Maximum Heading Level
2
Include Headings
Unknown.*

The resulting table of contents is:

Notes

  • When you use a Table of Contents macro in a template, you will see an error when you preview the template itself. But the Table of Contents macro works on the pages that people create from the template – the table of contents shows up after they have saved the page. (This is probably because the template is not defined as a page, and the Table of Contents macro works for pages only.)

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

    The syntax for the anchor name is the page name and heading name separated by a hyphen. Remove all spaces and convert all text to lower case. Convert all punctuation marks to their URL-encoded equivalent.

 

Code examples

The following examples are provided for advanced users who want to inspect or edit the underlying markup for a Confluence page. 

Macro name: toc

Macro body: None.

Storage format example

This example shows a list-type table of contents.

This example shows a flat table of contents.

Wiki markup example

This example shows a list-type table of contents.

This example shows a flat table of contents.

90 Comments

  1. It appears that Confluence only allows one TOC or TOC-ZONE macro on a page.

    If you have more than one, then all will use the formatting attributes of the first one on the page.

    (I was trying to format a page with one TOC for display on the page, and a second one within tags for inclusion on other pages)

  2. PR

    Is it possible to put the table of contents in a box / frame (like wikipedia does)?

    Thank you in advance

    PR

    1. I put it in a panel - but my problem currently is that it takes up the whole width of the page.

      1. Anonymous

        You can use the section and the column macro to setup a column with a defined width. When you put in this column the toc macro and the panel it won't use the whole screen width.

        1. Anonymous

          Your suggestion doesn't work.

          1. Sarah,

            Does this example work for you (copy and paste near the top of your page):

            {section}
            {column}
            Include introductory blurb here...
            {column}
            {column:width=240px}
            {panel}
            *On this page:*
            {toc:minLevel=2|maxLevel=2}
            {panel}
            {column}
            {section} 
            
            1. Anonymous

              Thanks! It worked for me. - Sanjeev

  3. Anonymous

    Hello. I'm looking for a way to render a table of contents so that the headings collapse. In other words, something like the {pagetree} macro, but rather than dealing with pages, it deals with headings in single document. Ideally I'd like to see some sort of expand collapse feature for {toc}.

    Is there a way to get this to work?

    1. Hello, as I am not sure what exactly you need to to with the expanding and collapsing table of contents I am using something like this:

      {toggle-cloak:id=contents}*To display the table of contents click here*

      {cloak:id=contents}
      {toc}
      {cloak}

      ...some hints:

      1. toggle-cloak:id=contents -> the word "contents" needs to be the same also in cloak:id=contents
      2. "*To display the table of contents click here*" - this is custom - can be replaced by any text
      3. if this is placed within a page, {composition-setup} is required to be placed before the macros or at the top of the page

      Hope this helps, enjoy your day (smile)

      1. Anonymous

        Hi MIroslav:

        I tried your macro above:

        {toggle-cloak:id=contents}*To display the table of contents click here*

        {cloak:id=contents}
        {toc}
        {cloak}

        but it gave me the following error when I view the wiki:
        Unknown macro:{toggle-cloak}
        Unknown macro:{cloak}
        Am I missing something?  Also looks like they just update confluence to the latest ver and now I can't edit my document in the wiki Markup mode directly.  I need to do it in rich text editor mode and go to Insert -> Wiki Markup to insert...
        Any help will be appreciated!  Thx!
        thx,
        Antonio.
    2. Anonymous

      I vote for this feature. I'd like to see an expandable/collapsible TOC that shows h1s by default, with the subheadings collapsed. I'm not having any luck making this happen with wiki markup.

      1. Anonymous

        In v4.3.6, the wiki markup for TOC doesn't even work properly when in Documentation Theme, customizing the left-nav sidebar to use TOC instead of page tree. Does it work in other versions?

         

  4. Hi,

    While using the TOC macro on an imported word document, for some reason the final headings in the table of contents are appearing in the toc but are not linking to the heading anchors in the text.

    Can you offer any insight into this?

    Thanks,

    Em

  5. I use the {toc} macro to build a table of contents that includes headings for included pages. To do this, I use the includePages parameter. There does not seem to be any documentation on the Confluence site about this parameter; I found information at Adaptavist.

    Is this a deprecated feature? If not, would it be possible to update the documentation to include the definition and some examples?

    Thanks!

    1. Are there any updates related to my question planned for the the new documentation? If the functionality is being migrated to another macro, please let me know which macro I should now use.

      Thanks!

  6. Hi,

    I have a page structure as the following:

    Home

    - page 1

     -- subpages

    - page2

      --subpages

    When exporting to PDF, I would like the headings of "page 1" and its children  to  be numbered as listet in the toc. Unfortunately I do not know how to do this.

    Second, it would be nice, if home was not numbered and the counting would start with page 1, since home seems to be the only parent page possible. This is quite unfortunate since my wiki must me exported to PDF as an support manual.

    Do you have any suggestions?

    Thx, Miriam

  7. I am using the TOC macro to create an index to information imported to a page via the metadate-report macro. The metadate-report is in a column on the left and the toc is in a column to the right. All works fine except that the toc does not show any new headings that have shown up since the last time the page with the toc was edited and saved. The new items show up in the metadata but the list in the toc does seem to get updated. It seems that the content of the toc is generated when the page is saved and does not refresh each time the page is displayed.

    can anyone give me some insights?

    I would like to know if this is a bug or a new feature.

    I am using Confluence 3.2 and TOC 2.4.11

    1. Anonymous

      the same problem for me

  8. I have an issue with the TOC macro and Firefox. If the heading contains a comma (,) or brackets (()) or any number of other "special" characters, the anchors the macro creates replaces those characters with entities.

    For example, 

    ITSM (IT Service Management)

    Creates the anchor

    ITSM%28ITServiceManagement%29

    The link works fine in IE and Chrome, but Firefox changes the %28 and %29 back to ( and ), which doesn't match the anchor and so the link fails.

    Firefox is the browser of choice for most of the people where I work, and it is frustrating for so many links to fail.

    It would be great if there was a parameter for the TOC macro that would cause "special characters" to be ignored when the anchor is created.

    1. Hi Cody,

      Just to inform you that this bug was fixed in confluence 5.2.5 as you can see in here :

      CONF-26765 - Redirect to anchors in pages with titles that contain special characters is broken Resolved

      So upgrading your confluence to version 5.2.5 or latest will do the trick (smile).

       

  9. Anonymous

    Hi All,

    I have quick question... I have a doc that looks like this:

    The TOC macro doesn't seem to properly handle the nesting of repetitive subsection names. Any of the "Success" entries will always point to the the first one in the doc? Anyone have a workaround/suggestion other than renaming the sub headers?

    Thanks,

    Marc

    1. If you don't mind having your markup a little ugly, you can do something like the following:

      h1. Some top level header
      h2. Succes{color}s{color}
      h2. Faile{color}d{color}
      h1. Another top level header
      h2. Succ{color}es{color}s
      h2. Fai{color}l{color}ed
      

      The toc macro will ignore the text in the {color} macro when it creates the anchor for the heading, which will make your anchors unique. Other macros besides {color} would probably work as well.

      1. Anonymous

        Haha, that is one hell of an ugly hack. And your repetitions are limited to the number of permutations on the length of your section headers. :D
        But I guess it works, so thumbs up for that!^^

      2. Using the wiki markup to modify / differentiate the headers doesn't appear to work anymore.  I'm guessing it is because the wiki markup is translated into whatever is really stored, and what is really stored is no longer different.  The workaround I'm using is to add spaces to the end of the header, but this does not look great in the TOC

  10. Anonymous

    There seems to be a bug in the TOC macro when users change the color of a header. The TOC generates, but the TOC linking does not work properly. Has anyone had success creating a TOC out of colorized headers? If the headers use the default color, the TOC works fine. 

    1. Yes, would love to see this fixed!!

    2. Anonymous

      I seem to be having this issue as well – is there a fix?

    3. Anonymous

      Same problem for us. Putting any text color in a heading breaks the toc links. So I ended up putting a star image in front of the text for each heading using one of their misc notations.

  11. We have a couple users that have used the TOC macro on their pages and generated emails based on the page.  In those emails, the link to pages work, but the TOC links, being relative, do not seem to behave properly.  Users that click on the TOC links are taken to the Dashboard instead of the page.  It appears that the TOC links in the emails are being sent to http://server.name/contextroot/#relativeTOCLocation instead of the actual page.  Anyone else seen similar behaviour or know how we might get around this?

    Thanks

  12. I had a toc-zone macro that worked beautifully before Confluence 4.0

    Now I am reorganizing the page and need to remove the toc-zone macro. When I remove the macro, all of the text that was included within the toc-zone macro disappears too.

    I tried copying the text and pasting it before the macro, but the that didn't work.

    It would be a snap to remove the macro in wiki markup. Now I am just frustrated. The car has stopped running, I'm a certified mechanic, but the hood latch is locked.

  13. The TOC macro seems to conflict with the Tasklist Macro. I'm using Confluence 4.0.

    To reproduce:

    • Create a new page
    • Create a tasklist
    • Save
    • Add a task: "My Task"
    • Edit
    • Create a TOC at the top
    • Save
    • View the page: "My Task" is gone

    If you edit the page again you can still see the task data, it just doesn't show up when you view the page.

  14. Please provide examples of How to exclude things from the TOC ? I am having issues with the PROFILE macro, the name of the user is included in the TOC.

     

    Thanks in Advance!

  15. Anonymous

    It seems that the TOC linking is not working in Confluence 4.1.3. Only the first link works, the others are broken. I think this is due to wrong syntax of the <a> anchors in the TOC. This error is very serious because to us its very importent to have a TOC above of long pages.

    1. Anonymous

      Same issue for me. Someone has a solution for this?

      Only solution what I know of: Delete textformat (copy to notepad and copy back to confluence) and apply (again) all textformat and add the TOC.

      This solution is not really workable when a lot of pages needs to be adjusted/converted. Please help.

       

       

    2. Anonymous

      Same here.

      Some links in TOC work, others don't. The ones that don't work have rel="nofollow" attribute, which is probably what causing the problem.

      -- Maxim

      1. You're right those links indeed have a 'nofollow' attribute. This macro becomes not usable on 4.x. Can anyone make an effort to improve?

  16. Has anybody had problems with TOC macro when it is on a page that it included to another page? The links work fine on the original page but looks like they do not work on the page where it is included into.

    (version is 3.2.1_01)

    1. Anonymous

      This is exactly why I'm here - was trying to see if there is something to do. Looks like nothing.

      1. Anonymous

        Still the same in Confluence 4.3.2!

        Is there an open issue on that?

        Regards

        Harald Mueller

        Software AG

  17. this marco didn't work well in confluence 4.1.9.

    if i uncheck printable then i expect that the toc didn't gets printed but it also didn't gets shown.

    cheers, michael

    1. Anonymous

      I have the same issue - really defeats the purpose of that parameter. I input a support ticket today because we need this to exclude from our pdfs that we generate as our user-guides. We'll see what they say...

      Seems like the TOC macro is quite buggy

       

      1. Anonymous

        Having the same issue and wondering if there was a bug fix for this out there yet. We need the ToC to be available when reading online but to not appear when exporting to a PDF.

    2. This is a known issue. See here:

      https://studio.plugins.atlassian.com/browse/TOC-130

      As far as I can tell, it was reported in February and there hasn't been any movement on it at all–not even a response from the developer to indicate whether they intend on fixing it.

      If this is affecting you, I recommend going to the bug and clicking on the "vote" and "watch" links so the developers know that people are interested.

       

  18. Is there any way to automatically add an active table of contents?  The "Insert -> Table of Contents" feature seems to create just a list of headers on the page, but they aren't clickable.

     

    Also and related, is there a way to set a page so that it doesn't use the "blue and underlined" css for things that are NOT links.  It is confusing when it seems to be everywhere that confluence seems to think needs emphasis.

  19. Anonymous

    Bump - I have the same concerns as Skip

  20. I am using Stepstone's Zen editor–the TOC is messed up there. It doesn't update with the latest additions. I know you guys don't support Stepstone plugin, but the TOC macro is Atlassian's. They don't seem to work well inside Zen's editor.

  21. Anonymous

    I'm trying to add a TOC to my wiki article, however my article has other articles embedded in it(cloaked). I only want the TOC to display headings from my article. Is there a proper solution to this? Thanks in advance.

  22. Anonymous

    the toc macro if we have headings spread across various tabs in the card-deck arrangement. Is this a bug?we are using version 3.5.13

  23. Anonymous

    The toc macro fails to navigate if we have headings spread within various tabs in a card-deck arrangement. Is this a bug? we are using version 3.5.13. Thanks

  24. Anonymous

    we are getting an: 

    Error formatting macro: toc: java.util.EmptyStackException

    error. Any ideas what the cause of this could be? It used to work in earlier versions. We are currently using confluence 4.2.4 and plugin version 2.6.0.  

  25. Anonymous

    I too am getting this error.  It appears to be related to the inplace editor

  26. When I'm using ToC macro, it inserts the Anchor macro in the ToC as well. So the link then leads to ToC page, not to the original Anchor location. Is there a way to get rid of this bug? 

  27. Anonymous

    Hi i need your help please. Im working on Confluence 3.2 and I want to add a table of contenst but the only thing that happens is that it appears "

    Unknown macro: {toc }

    "

    i havent found the way to make it. It just writes that and nothing is happening. Does anyone knows that happens or what im i doing wrong?

    thanks!

  28. Anonymous

    the "unknown macro" doesnt appear, just the "toc"

  29. Anonymous

    The background. I wanted to have titles of "h2." or "h3." with content hiden under them. Orginally I used,

     Example of Body Text Title

    though it made the heading appear as body text (sad) but I discovered

    which presents the title in an improved heading like format.

    This is great HOWEVER when I use

    none of the headings that are expandable appear in the table of contents (sad)

    Any tips on how to get expandable headings into "toc"???

  30. Anonymous

    I have three issues with my article. Please help me with solutions. Thanks!

    • My TOC shows partially in blue and black. How can I fix to show only in Blue as visited links? 
    • My TOC shows a dangling bullet at the end of the list. How can I eliminate this bullet?
    • I also seem to have a large space between the last sentence in the article and the comments section. How can I eliminate the space?
    1. yes, in version 5.2.9 TOC shows blue and black link. It's very bad for documentations.

  31. Guys, This product is amazing, but I am having issues with exporting to PDF, I have been working for a few days at the export to pdf functionality. I have successfully configured the multi-page export to PDF to work properly. All pages are exported to a single document with a page-by-page index as the title page, unfortunately all of the TOC that I have on multiple pages do the same thing and force a page-break before and after the TOC, this makes the PDF export longer than necessary and inconsistent. I guarantee there is a way to fix this in the Space or Global PDF Style-sheet control but can't figure out what the content I need to add to make this work. Can anyone help with this?

    1. I attempted to fix this issue by the following adjustment in the PDF Stylesheet

      NOTE : THIS DID NOT FIX THE ISSUE, DO NOT COPY

      div.toc {  

        page-break-before: none;  

        page-break-after: none;  


       

    2. Hi Nathan, 

      I'm not aware of any workaround for this issue, however it has been fixed in Confluence 5.1.3 if you are able to upgrade. If you are an OnDemand customer you should have the fix already.  You can see details on the issue here  CONF-28252 - Page break before and after Table of Contents macro are forced in PDF export Resolved .  

      Rachel 

  32. Anonymous

    With the latest version of Confluence On Demand, I am finding that TOC heading links to not work when the heading has a question mark in it. There is an old JIRA about this issue, but it was supposedly fixed many versions ago. Has the problem resurfaced? Is there a work around – other than not including the question mark? (It is a FAQ page, so question marks in headings are difficult to avoid!)

    Thank you.

    1. Hi Anonymous, I have have not been able to replicate your issue in OnDemand (for me headings with ? characters appear and work fine in the table of contents macro). You might want to raise a support issue or a bug about this. 

  33. Anonymous

    Thank you for your response, Rachel. I did a bit more investigating. It appears to only be an issue on FireFox – but is definitely an issue there (including with pages in the Confluence documentation that have question marks in the headings). The links work fine on Chrome and Safari. I will log a bug.

    Nicole

  34. Logged this bug: CONF-30485 - (In Firefox browser) Links in Table of Contents Macro not working when heading includes a question mark Resolved

  35. Hi,

    Version 2.6.7 of the TOC plugin produces only a numbered TOC list without the heading text. Is there a bug in the plugin? or should something more be configured to also get the heading text in the TOC list?

    Confluence 5.1.4 is used as WAR installation.

    Regards, Kjell

    1. Anonymous

      I am having the same issue with my wiki's since updating to Atlassian Confluence 5.2. Pages that worked previously now display as just the numbered heading. I haven't been able to identify a bug for this yet but I suspect that we will need to search their open issues or report it in the correct forum. 

      1. I would suggest logging a bug for this.  You can do this at http://jira.atlassian.com/browse/CONF

  36. My TOC module breaks if the page I am using had the HTML or CODE block modules anywhere.  If I remove them, no problems.  Is there a fix planned or what is the solution

  37. Hello,

    TOC links are not working, if:

    • ":" is in title, or
    • any special character (eg. ü ä) are in the heading.
    1. Hi Ulrich, this should have been fixed - see CONF-26765 - Redirect to anchors in pages with titles that contain special characters is broken Resolved .  If you are using 5.2.5 or later and still experiencing this issue could you please raise a bug or contact Support? 

      1. Thanks for reply. Yes, I can confirm, this bug is fixed in 5.3...

  38. Hi,

    We just upgrade confluence from 4.3.2 to 5.2.5, and Table of Content plugin has been upgraded from 2.6.1 to 2.6.10.

    I found the page with TOC macro displayed differently, the table of contents in old version has Strikethrough if the contents headings contain Strikethrough, but the new version do not include Strikethrough anymore.

    Is this a bug or the functionality has been changed?

    Thanks

    Sherry

    1. Hi Sherry, I've just tried this with v 2.6.10 of the Table of Contents plugin on Confluence 5.3 and it works as expected.  If you continue to have problems with 5.2.5 you might want to contact Support or raise a bug

  39. Anonymous

    I added a table of contents to my page, but now the save button is disabled. The only way I have found out of it is to close the window, and then choose to restore the previously saved version, removing the table of contents. What am I doing wrong here?

    1. Sounds like something fishy is going on, I'm not able to replicate the behaviour you describe.  You might want to contact Support or raise a bug about this one.

  40. Anonymous

    Is there any way to globally change the css in order to ensure that there are no bullet points for the TOC? 

    1. In the macro parameters you can specify none in the list style field to show the list with no bullet points. I'm not aware of a way to do this in the space CSS however.  You might want to ask your question at Answers as someone in the community may have a solution for you. 

  41. Is there anyway to have the Table of Contents include page numbers when printed or exported to Word/PDF?

    We're attempting to use Confluence to track all of our documentation. Some of this documentation, such as a handbook, has to be printed for signing, etc from time-to-time.

    1. Hi Kevin, you can use the following css to include page numbers in the ToC.

      The code is taken from the example stylesheet available from confluencedefaultpdf.css.

      1. Hello Adrian,

        Since the code you're referring to is in the default css already, shouldn't the Table of Contents include page numbers when printed or exported to Word/PDF as default (ie. no need to change anything to have this functionality)? We have the same problem here as Kevin, our table of contents just show the section numbers and titles, nothing else. We'd like to have dots (.) and page numbers displayed as well. Like so:

        1.1 One Title ....................................................... 32

        It doesn't seem possible, since the default css already has:

             span.toclead:before { content: leader(dotted); }

             span.tocnum:before { content: target-counter(attr(href), page, decimal ); }

        and all we get is:

        1.1 One Title

         

        1. Managed to solve it myself by stumbling onto Steffen Heller's post in an Atlassian Answers thread about the TOC not being generated at all:

          "The appearance of that list can be adapted and refined with CSS that you enter at Browse > Space Admin > Look and Feel > PDF Stylesheet > PDF Export Stylesheet

          If you want page numbers and a dotted line you can use

          1
          2
          3
          a:after {   
          content: leader(dotted) target-counter(attr(href), page);  
          }

          To avoid that all other hyperlinks on your page also get page numbers you better put your toc into another css class. For this you enter some_class_name (choose whatever you like) at "CSS Class Name" from the Edit menu of the {toc} macro and put exactly that some_class_name before the "a:after" so that you get ".some_class_name a:after" (don't forget the dot at the beginning)."

          https://answers.atlassian.com/questions/193991/toc-is-not-being-created-when-i-export-a-space-to-pdf-what-am-i-doing-wrong

          1. This solution created more problems that I solved while typing this, so I just thought I'd share in case anyone else gets stuck there too:

            Just adding the CSS Class Name to the Table of Contents Macro Edit menu (as mentioned above), makes the TOC show disc bullets before each section number as bullet points, both in the PDF Export and on the actual page. The indentation of each section of the TOC changes, and nothing happens whatever you try to change in the Table of Contents Macro Edit menu. For example, if you leave the "List Style" input field empty, press Save, and open the Edit menu again, it will now says "disc". If you put "none" or "circle" or "square", nothing happens to the TOC. If you leave the "Heading Indent" empty, or put 15px, or 200px or anything, nothing changes. If you remove the CSS Class Name, all the Table of Contents Macro Edit menu input fields work like they should again.

            So, I figured out that by entering a CSS Class Name in the Table of Contents Macro Edit menu, all TOC styling must now be done in the Global PDF Stylesheet (for the PDF Export) + the Global Stylesheet (for the actual page). So as Confluence Admin, you have to go to Global PDF Stylesheet and add your TOC styling there for your PDF export and then go to the Global Stylesheet and add your TOC styling there for your page.

            For example, to have your TOC align to the left side of the page, remove any bullets (list-style-type), have an indentation of 15px for each section, a dotted line and page numbers, you'll add the following:

            .some_class_name {
              margin-left: -15px;
              padding-left: 0px;
            }

            .some_class_name ul {
              list-style-type:none;
              margin-left: 0px;
              padding-left: 15px;
            }

            .some_class_name a:after {
              content: leader(dotted) target-counter(attr(href), page);
            }

  42. Hi:

    I could not create the table of contents successfully.

    The purpose is using Heading1 style, but the table of contents macro cannot extract the "Purpose" successfully.

    Could any body help me understand?

     

     

    1. Hi:

      I know the reason now. I have to save all once before I really activate the macro.

      1. I'm glad you were able to get the macro working.  In the macro browser, you can also click the Refresh icon  to update the preview - this helps you see what your table of contents will look like without saving the page. 

        1. Thanks Rachel, but I still have to remind you that the first save is necessary or the refresh button will not work.

           

          Best regards,

           

          Chong Yie

  43. Is there a way you could include a page anchor (Working with Anchors) in your table of contents without adding heading styles to it? I have a long table in a page, and I use anchors in the first column of the table, and use it to link to certain parts of the table. I can manually do it, but can I use the Table of Contents Macro to do the same?