Confluence 5.8 のサポートは終了しています。
ドキュメントの最新バージョンを確認してください。
The Table of Contents macro scans the headings on the current Confluence page to create a table of contents based on those headings. This helps readers find their way around lengthy pages, by summarising the content structure and providing links to headings.
目次マクロを使用する
ヒント: エディタ ツールバーにすばやくアクセスするには、[挿入] > [目次] を選択します。
目次マクロをページに追加する方法 オートコンプリートでマクロエントリを高速化: タイプ{とマクロ名の先頭には、提案したマクロの一覧を表示します。詳細は、こちらを参照ください。リンク、ファイル、マクロ、メンションのオートコンプリート 既存のマクロを編集する方法: マクロのプレースホルダをクリックして、[編集] を選択します。マクロのパラメータが編集可能な場合、マクロのダイアログ ウィンドウが開きます。
マクロ パラメーター
Parameters are options that you can set to control the content or format of the macro output. Where the parameter name used in Confluence storage format or wikimarkup is different to the label used in the macro browser, it will be listed below in brackets (example).
パラメーター | 既定 | 説明 |
|---|---|---|
出力タイプ | list |
|
セクション番号を表示 | clear | 見出しにアウトライン ナンバリングを適用します。例: 1.1、1.2、1.3. |
リスト スタイル | disc | 各リスト項目のブレット ポイントのスタイルを選択します。有効な CSS スタイルを使用できます。 例:
|
見出しのインデント |
| CSS の数に従って、リストのインデントを作成します。 |
区切り記号 | brackets | このパラメーターはフラットリストにのみ適用されます。 次の値のいずれかを入力できます。
|
見出しの最小レベル | 1 | TOC リストを開始する最大見出しレベルを選択します。たとえば、2 と入力すると、レベル 2 以下の見出しが含まれますが、レベル 1 の見出しは含まれません。 |
最大見出しレベル | 7 | 含める最小の見出しレベルを指定します。たとえば、2 と入力すると、レベル 1 および 2 の見出しが含まれますが、レベル 3 以下の見出しは含まれません。 |
見出しを含める |
| Filter headings to include according to specific criteria. You can use wildcard characters. See Sun's Regex documentation for examples of constructing regular expression strings.
|
除外する見出し |
| Filter headings to enclude according to specific criteria. You can use wildcard characters. See Sun's Regex documentation for examples of constructing regular expression strings.
|
印刷可能 | オン | 既定では、TOC は印刷用に設定されています。このチェックボックスをクリアすると、ページを印刷した際に TOC は表示されなくなります。 |
CSS クラス名 |
| お使いの CSS スタイル シートにカスタムの TOC がある場合、このパラメーターを使用して、指定した "class" 属性で |
絶対 URL (absoluteURL ) | 既定では、TOC のリンクは現在のページを示す相対的な URL です。これを選択した場合、TOC のリンクは完全な URL になります。この設定は、目次が入ったページを別ノページに含め、リンクをクリックしたユーザーの移動先を制御したい場合に便利です。 |
例
以下の例は、この目次に基づいています。
フィルターされた目次
This example filters the headings to include those that contain 'Favourite', but excludes headings which end with 'Things'. The list is styled with Roman numerals.
| パラメーター | 値 |
|---|---|
| リスト スタイル | upper-roman |
| 見出しを含める | Favourite* |
| 見出しを除外する | .*Things |
コンテンツの結果の表は次のようになります。
フラット リスト
この例では、すべての見出しをフィルターし、角括弧 (既定のリスト スタイル) で囲まれた「Unknowns」のフラット リストをレンダリングします。
| パラメーター | 値 |
|---|---|
| 出力タイプ | フラット |
| 最大見出しレベル | 2 |
| 見出しを含める | Unknown* |
コンテンツの結果の表は次のようになります。
注意
- テンプレートで目次マクロを使用すると、テンプレート自体をプレビューしたときにエラーが表示されます。しかし、目次マクロがユーザーがテンプレートから作成するしたページで機能し、目次はページを保存した後に表示されます。(これはおそらく、テンプレートがページとして定義されておらず、目次マクロがページに対してのみ機能するためです。)
- Due to an outstanding issue in the Table of Contents macro (CONF-10619), the macro browser's Refresh function does not render any parameter modifications. Currently, the rendering of parameter value modifications to the Table of Contents macro occurs only after the page is saved.
Using HTML heading markup with the Table of Contents macro
The Table of Contents macro cannot handle HTML heading markup on its own. Hence, if you use the HTML and HTML Include macros to render HTML heading markup in a Confluence page, the Table of Contents macro will not create a contents list out of these headings. (For more information about this issue, please refer to TOC-93.)
However, if you insert an HTML anchor into each HTML heading on your page (based on the following syntax), the Table of Contents macro will incorporate these headings into your contents list.<h2><a name="pagename-headingname"></a>見出し名</h2>
アンカー名の構文は、ハイフンで区切られたページ名と見出し名です。すべてのスペースを削除し、すべてのテキストを小文字に変換してください。すべての句読点を、対応する URL エンコードに変換してください。
コードの例
次の例は、Confluence ページの基本的なマークアップを調べたり、編集したりする上級ユーザー向けに提供されています。
マクロ名: toc
マクロ本文: なし。
保存形式の例
この例は、リスト タイプの目次を示しています。
<ac:structured-macro ac:name="toc">
<ac:parameter ac:name="printable">true</ac:parameter>
<ac:parameter ac:name="style">square</ac:parameter>
<ac:parameter ac:name="maxLevel">2</ac:parameter>
<ac:parameter ac:name="indent">5px</ac:parameter>
<ac:parameter ac:name="minLevel">2</ac:parameter>
<ac:parameter ac:name="class">bigpink</ac:parameter>
<ac:parameter ac:name="exclude">[1//2]</ac:parameter>
<ac:parameter ac:name="type">list</ac:parameter>
<ac:parameter ac:name="outline">true</ac:parameter>
<ac:parameter ac:name="include">.*</ac:parameter>
</ac:structured-macro>
この例では、目次のフラット テーブルを示しています。
<ac:structured-macro ac:name="toc">
<ac:parameter ac:name="maxLevel">2</ac:parameter>
<ac:parameter ac:name="minLevel">2</ac:parameter>
<ac:parameter ac:name="class">bigpink</ac:parameter>
<ac:parameter ac:name="exclude">[1//2]</ac:parameter>
<ac:parameter ac:name="type">flat</ac:parameter>
<ac:parameter ac:name="outline">true</ac:parameter>
<ac:parameter ac:name="separator">pipe</ac:parameter>
<ac:parameter ac:name="include">.*</ac:parameter>
</ac:structured-macro>
Wiki マークアップの例
この例は、リスト タイプの目次を示しています。
{toc:printable=true|style=square|maxLevel=2|indent=5px|minLevel=2|class=bigpink|exclude=[1//2]|type=list|outline=true|include=.*}
この例では、目次のフラット テーブルを示しています。
{toc:printable=true|maxLevel=2|minLevel=2|class=bigpink|exclude=[1//2]|type=flat|outline=true|separator=pipe|include=.*}

