Table of Contents macro - how can I exclude a header *and all its subheaders* in the TOC?

Linus W
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 24, 2018

I see how I can use regexs to exclude arbitrary lines, but I would like all subheadings to be excluded as well, if a parent header is excluded. However, I only want my Heading 1s to differ by name, while all sub-sections of each Heading 1 to use the same naming structure. So if I had something like:

* Phase 1 - master the kraken
  * step 1
  * step 2
* Phase 2 - deploy the kraken
  * step 1
  * step 2
  * step 3

and only wanted to show "Phase 1" items for now, is there a way to get the TOC Macro to also exclude "Phase 2" and everything below it, without having to rename all the sub-sections with a string unique to phase 2 so a regex can find them all?

1 answer

1 vote
Bill Bailey
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 26, 2018

Not sure what your use case is (why you want to do this), but I cannot think of any way to do what you want to do with the ToC macro without adding some constant text to headings you don't want to appear.

The only other way I can think of is the wrap the ToC macro in a user macro, then apply CSS to hide what your don't want (nth child selectors).  Or just create a custom user macro.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events