Forums

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

How do I create a numbered list in Confluence using a custom macro?

Anastasia March 19, 2019

Как создать нумерованный список в слиянии с помощью пользовательского макроса?

Example:

1.Example

1.1 Example

1.1.1 Example

1 answer

3 votes
Rafael Pinto Sperafico
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.
March 19, 2019

Hi @Anastasia ,

You could accomplish that with CSS2:

## Macro title: My Nested List
## Macro Body Processing: No macro body
##
## Developed by: Rafael Pinto Sperafico
## Date created: 19/03/2019
## Installed by: Rafael Pinto Sperafico

## Macro displays numeric nested list
## @noparams
<style>
#my-nested-list ol { counter-reset: item }
#my-nested-list li { display: block }
#my-nested-list li:before { content: counters(item, '.') ' '; counter-increment: item }
</style>
<div id="my-nested-list">
<ol>
<li>Item</li>
<li>Item
<ol>
<li>Sub-item</li>
<li>Sub-item
<ol>
<li>Sub-item</li>
</ol>
</li>
</ol>
</li>
</ol>
</div>

Kind regards,
Rafael

Anastasia March 20, 2019

Спасибо!!!! Может вы знаете как сделать нумерацию заголовков, расположенных в дереве страницы. И уже исходя из нумерованного заголовка пронумеровать все пункты.Например:Снимок.PNG

Rafael Pinto Sperafico
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.
March 20, 2019

Hi @Anastasia ,

If you visit the Space where those pages are being created, having a admin permission to that Space you could change the Look and Feel (Space Tools >> Look and Feel)

In there, please select Stylesheet tab and add/append the following CSS2:

#content.page.view {
     /* Set "section" to 0 */
    counter-reset: section;
}

#content.page.view h1 {
     /* Set "subsection" to 0 */
    counter-reset: subsection;
}

#content.page.view h1:before {
    /* Increment "section" by 1 */
    counter-increment: section;
    content: counter(section) " ";
}

/* Continue this scheme as deep as you need */

#content.page.view h2 {
    counter-reset: subsubsection;
}

#content.page.view h2:before {
    /* Increment "subsection" by 1 */
    counter-increment: subsection;
    content: counter(section) "." counter(subsection) " ";
}

#content.page.view h3:before {
    counter-increment: subsubsection;
    content: counter(section) "." counter(subsection) "." counter(subsubsection) " ";
}

Save it and visit your page once again. Headers should now be automatically numerical.

Notes

  • during editing mode, numbers are not displayed
  • when selecting Export as PDF or Word, numbers are not displayed

In case you want to have those numerical headings available when editing and/or exporting, perhaps you should give it a try using plugins available on https://marketplace.atlassian.com/

Kind regards,
Rafael

Anastasia March 20, 2019

Спасибо!!! А какие именно плагины? Просто когда я вставила код ничего не отображается и вы упомянули про плагины и дали ссылку, но ссылка просто на marketplace.

Rafael Pinto Sperafico
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.
March 20, 2019
Like Valentina_Lemiakina likes this
Anastasia March 20, 2019

Спасибо, вы очень помогли!!!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events