Don't add headings from included files to TOC macro

XMLWordPrintable

      observed behavior

      Using a third-party macro (specifically, Bitbucket file from the {{}}[Include Bitbucket add-on|https://marketplace.atlassian.com/apps/1212529/include-bitbucket-for-confluence?hosting=cloud&tab=support], I included a Markdown file in a confluence page for reference.

      The TOC macro obviously parsed the page AND the included file and now also contains the headings of Markdown file. They are inserted at the respective level (i.e. level 1 of the markdown is also level 1 of the page) and thus break the existing page layout. 

      Also, the links then don't work.

      The only way to work around this is to exclude all headings from the markdown in the TOC macro. But as the Markdown file is obviously edited on Bitbucket, this filtering will not work for long...

      steps to reproduce

      1. create a page with the TOC macro and some headings (best shown if you have mutliple levels)
      2. include a markdown file with some headings using the Bitbucket file macro
      3. Check the generated TOC

      expected behavior

      The markdown file is not parsed and not included in the TOC, keeping the page layout intact.

      suggestion

      Either:

      • provide a filter to exclude the content of specific macros from being parsed and used in the TOC macro

      Or:

      • parse the content of the macro and insert it a level below the current header level.

      background

      I wasn't sure whether to post this as a bug or as a suggestion. Seeing that [creating the TOC from HTML pages (see bullet under "Notes and known issues"|https://confluence.atlassian.com/doc/table-of-contents-macro-182682099.html] seems to describe a similar but wanted behavior, I guess that having this could also be considered expected behavior.

      If you create your page from multiple other pages, this seems fine. But for documentation purposes including markdown files (README.md, mostly) but having them collapsed is something we do quite often. This provides all required info in one place, but having this content show up in the TOC is distracting and creates more confusion.

      If required, I'm happy to provide more details and / or  screenshots of a sample page which illustrates the issue.

            Assignee:
            Unassigned
            Reporter:
            Matthias Gruhler
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: