Numbered Sections Macro

Links
Developer Network
Name Numbered Sections Macro
Author(s)  
Priority Medium
Description Automatically number headings.

I'd like to be able to surround a block of wiki-content with a macro that would automatically number and anchor all the h1..h5s. Kinda like Word would do it. It would be nice if this could be combined with the Table of Contents macro too.

Also, people want: Collapsible outline, multiple sections (eg, 3.2.2.4: technical spec, 3.2.2.4: testing spec match up), comment/approve at any level in the tree.

Labels

confluence confluence Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Feb 22, 2006

    Guy Fraser says:

    All headings are already automatically anchored (that's how the table of content...

    All headings are already automatically anchored (that's how the table of contents macro links to them).

    It may be worth waiting until more browsers support CSS2 as there are features in CSS2 which would make this task as trivial as updating a style sheet.

    1. Feb 23, 2006

      Jonathan Nolen says:

      So that would be, say... 2010?

      So that would be, say... 2010?

      1. Feb 23, 2006

        Guy Fraser says:

        Only if Micro$oft go bankrupt. If they don't, then we could be waiting forever

        Only if Micro$oft go bankrupt. If they don't, then we could be waiting forever

  2. Oct 31, 2007

    Tiffany Bartlett says:

    Hi all, I wrote this macro, which will auto-number headings 1 through 6. It al...

    Hi all,

    I wrote this macro, which will auto-number headings 1 through 6. It also changes the font-size and color so the Confluence page looks more like a Word doc. (Just delete that part if you want the normal heading sizes.)

    Click on Administration, User Macros, Create a New User Macro, copy and paste. On the pages that you want auto-numbered headings, type

     {document_style}
    

    . Just once, not at the top and bottom of the page.
    Here's where I need help -- the heading styles won't export. Any suggestions on how to get the export to use this macro?

    -Tiffany

    #set($globalHelper=$action.getGlobalHelper())
    #set($renderer=$globalHelper.getWikiStyleRenderer())
    #set($context=$content.toPageContext())
    #set($renderedContent=$renderer.convertWikiToXHtml($context, $body))
    <span class="document_style">${renderedContent}</span>
    <style type="text/css">
    <!--
    h1
     {
           font-size:12;
           font-style: bold;
           font-weight: bold;
           line-height:100%;
           font-variant: small-caps;
     counter-increment: h1c;
        counter-reset: h2c;
    color: black;
    }
     h1:before {
        display: marker;
        content: counter(h1c) ". ";
      }
    h2
    {
           font-size:12;
           font-style: bold;
           font-weight: bold;
           line-height:100%;
     counter-increment: h2c;
        counter-reset: h3c;
    color: black;
    }
      h2:before {
        display: marker;
        content: counter(h1c) "." counter(h2c) ". ";
      }
    
    h3
    {
           font-size:12;
           font-style: bold;
           font-weight: bold;
           line-height:100%;
    counter-increment: h3c;
        counter-reset: h4c;
    color: black;
    
    }
    
     h3:before {
        display: marker;
        content: counter(h1c) "." counter(h2c) "." counter(h3c) ". ";
      }
    
    h4
    {
           font-size:12;
           font-style: bold;
           font-weight: bold;
           line-height:100%;
       counter-increment: h4c;
        counter-reset: h5c;
    color: black;
    }
     h4:before {
        display: marker;
        content: counter(h1c) "." counter(h2c) "." counter(h3c) ". " counter(h4c) ". ";
      }
    
    h5
    {
           font-size:12;
           font-style: bold;
           font-weight: bold;
           line-height:100%;
      counter-increment: h5c;
        counter-reset: h6c;
    color: black;
    }
     h5:before {
        display: marker;
        content: counter(h1c) "." counter(h2c) "." counter(h3c) ". " counter(h4c) ". " counter(h5c) ". ";
      }
    
    h6
    {
           font-size:12;
           font-style: bold;
           font-weight: bold;
           line-height:100%;
      counter-increment: h6c;
    color: black;
      }
      h6:before {
        display: marker;
        content: counter(h1c) "." counter(h2c) "." counter(h3c) "." counter(h4c) ". " counter(h5c) ". " counter(h6c) ". ";
      }
    
    
    -->
    </style>