1. Infrastructure
  2. INFRA-3938

Apache CMS does not create correctly nested TOC structure from document headings hierarchy


    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Fix Version/s: Initial Clearing
    • Component/s: Website
    • Labels:
    • Environment:
      Apache CMS


      I'm using the CMS to create our podling's web site. According to, I can use the [TOC] element to create a table of contents from the headers in the document, but I'm having a problem with it. Consider the following document:

          Title: TOC test
          The title above will generate an h1 element from the CMS scripts
          ## I am the first h2
          lorem fubarum
          ## I am the second h2
          lorem fubarum
          ### I am the first h3
          lorem fubarum
          ## And I'm back to h2
          lorem fubarum

      The structure created by the TOC element does not match the hierarchy in the document. This is what I get, using a local copy of the CMS scripts, SVN update'd today (NB I hand-edited the indenting for clarity):

          <div id="content">
          <h1 class="title">TOC test</h1>
          <p>The title above will generate an h1 element from the CMS scripts</p>
          <div class="toc">
            <li><a href="#i_am_the_first_h2">I am the first h2</a>
                 <li><a href="#i_am_the_second_h2">I am the second h2</a>
                     <li><a href="#i_am_the_first_h3">I am the first h3</a></li>
                 <li><a href="#and_im_back_to_h2">And I'm back to h2</a></li>
          <h2 id="i_am_the_first_h2">I am the first h2</h2>
          <p>lorem fubarum</p>
          <h2 id="i_am_the_second_h2">I am the second h2</h2>
          <p>lorem fubarum</p>
          <h3 id="i_am_the_first_h3">I am the first h3</h3>
          <p>lorem fubarum</p>
          <h2 id="and_im_back_to_h2">And I'm back to h2</h2>
          <p>lorem fubarum</p>

      It seems that the first encountered sub-head always becomes the parent of the other sub-heads of the document, regardless of their relative hierarchy levels. Since the `Title:` element will automatically create an h1 for the page, it seems natural to me that the remaining heads should start at h2, but I wonder if this is confusing the markdown TOC module.


        Ian Dickinson created issue -
        Joe Schaefer made changes -
        Field Original Value New Value
        Status Open [ 1 ] Closed [ 6 ]
        Resolution Won't Fix [ 2 ]
        Tony Stevenson made changes -
        Workflow jira [ 12633650 ] INFRA Workflow [ 12715604 ]
        Gavin made changes -
        Fix Version/s Initial Clearing [ 12325964 ]


          • Assignee:
            Ian Dickinson
          • Votes:
            0 Vote for this issue
            0 Start watching this issue


            • Created: