How to have nested number lists in Confluence

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Fisheye および Crucible は除く

The information in this page relates to customisations or development changes in Confluence. Consequently, Atlassian Support cannot guarantee to provide any support for the steps described on this page. Please be aware that this material is provided for your information only and that you use it at your own risk.

 The steps described in this page has been tested on Confluence 5.8.4

問題

Currently, numbering style in Confluence is as follows

However, some users would like this style to be changed and using a nested number list instead

診断

This style is not readily available in Confluence. 

回避策

To implement the style change within a space:

Add the following CSS code on Confluence space Stylesheet.

(warning) This workaround includes a customization and might not be compatible with previously implemented customization in Confluence. Please try the following workaround in a test space first.

  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 */
}

 

To implement the style change within a specific list:

Utilize the usage of User Macros.

  1. Create a user macro by going to Confluence Admin > User Macros > Create a User Macro. For example:

    フィールド
    macroNamenestedlist
    表示方法Visible to all users in the Macro Browser
    マクロ タイトルNested Number List
    説明 Change number list style to nested number list
    カテゴリConfluence Content
    アイコンの URLこのフィールドは空白のまま残すことができます
    ドキュメント URLこのフィールドは空白のまま残すことができます
    マクロ本文処理Rendered
    テンプレート

    テンプレート フィールドに以下のコードを入力します。

     

    ## @noparams
    <div class="nestedlist">$body</div>
  2. Define the CSS for this user macro by going to the space you would like to implement the user macro in > Space Tools > > Look and Feel > Stylesheet

  3. Edit > copy and paste the following code > Save

    .nestedlist ol {
        counter-reset: item;
    }
    .nestedlist ol li {
        display: block;
        position: relative;
    }
    .nestedlist ol li:before {
        content: counters(item, ".")".";
        counter-increment: item;
        position: absolute;
        margin-right: 100%;
        right: 10px; /* space between number and text */
    }
  4. Now you can add the macro to your Confluence page using the Macro Browser. Number lists entered into the body of the macro placeholder will change its style to numbered nested lists

最終更新日 2018 年 11 月 2 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.