Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to have nested number lists in Confluence

David Csikkel June 29, 2019

Hello, 

I have found recommended solution:

  1. Go to the space that you would like this numbering be implemented on
  2. Go to Space Tools > Look and Feel > Stylesheet
  3. Edit > copy and paste the following code > Save
ol {
    counter-reset: item;
}
ol li {
    display: block;
    position: relative;
}
ol li:before {
    content: counters(item, ".")".";
    counter-increment: item;
    position: absolute;
    margin-right: 100%;
    right: 10px; /* space between number and text */
}

It works but... very big BUT...

it breaks confluence pages on many places, some examples:

1) broken breadcrumbs navigation

 

1 answer

0 votes
Davin Studer
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.
July 1, 2019

How about doing it with a user macro? Then you can contain the scope. Something like this should work. It will not look the way you want in edit mode, but it will look the way you want in view mode and it should only be scoped to what is in the user macro.

Maco Name:
nested_number_list

Macro Title:
Nested Number List

Macro Body Processing:
Rendered

Template:

## Developed by: Davin Studer
## Date created: 07/01/2019
## @noparams

#set( $id = $action.dateFormatter.calendar.timeInMillis )

<style type="text/css">
/*<![CDATA[*/
#nested-list-$id ol {
    counter-reset: item;
}
#nested-list-$id ol li {
    display: block;
    position: relative;
}
#nested-list-$id ol li:before {
    content: counters(item, ".")".";
    counter-increment: item;
    position: absolute;
    margin-right: 100%;
    right: 10px; /* space between number and text */
}
/*]]>*/
</style>
<div id="nested-list-$id">$!body</div>

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events