toc

Last modified by Lucas Charpentier on 2026/10/27 10:30

Audit

Macro ID
toc
Source
XS
Type
Generator
Classification reason

Status
Reviewed
Criteria version
15.20
XWiki version
18.8.0
Audit date
2026-10-14
Auditor
Compared macros
children documentTree

Sources

Where to gather the information the criteria are checked against, see Gather the sources.

SourceWhat it givesUsed forWhere
DocumentationParameters, default values and examples, including the most common exampleL2, L3, and the criteria measured with the most common examplehttps://extensions.xwiki.org/xwiki/bin/view/Extension/TOC%20Macro#HFromWikiSyntax
Source codeHow the macro declares its parameters and content: types, groups, features, advanced and hidden flags, constraints, content type, inline supportC4, C5, C7, C8, C9, C13, E4, E6https://github.com/xwiki/xwiki-rendering/blob/xwiki-rendering-18.8.0/xwiki-rendering-macros/xwiki-rendering-macro-toc/src/main/java/org/xwiki/rendering/internal/macro/toc/TocMacro.java
Macro descriptorWhat the Edit Macro dialog is built from, on design.xwiki.orgD1, D2, C1 to C9, E4Descriptor, list of macros with their categories
TranslationsThe name, description and parameter names in each languageD1, D2, D4, C1l10n.xwiki.org
Uses in XWiki pagesHow XWiki itself uses the macro, a realistic example when the documentation has noneL3, C2, C3, C6, C8, C9Search the xwiki organization on GitHub
Compared macrosThe audits of the macros of the same typeL1, D3children, documentTree
Other sources specific to this macro
CriterionResultNotes
D1 wordingOK
D2 summaryKOthe description "Generates a table of contents." repeats the name, and does not say that the macro lists the headings of the page as links to them.
D3 categoryOK
D4 quick-actionKOQuick Actions finds the macro first for "toc", "Table of contents", the French name "Table des matières" and the synonym "contents". The synonyms "outline", "headings", "index" and "summary" give no result: "headings" only lists the Heading 1 to 6 actions.
L1 consistencyOKcompared with children and documentTree: like them, no parameter is mandatory, there is no content, and the Quick Action inserts the macro right away, with no dialog.
L2 doc-parametersKOthe parameters are only documented on the legacy extensions.xwiki.org page, not in the new documentation.
L3 doc-exampleOK
I1 patternOKcompared with children, the reference generator: both are inserted by their Quick Action without a dialog, and through the Insert Macro dialog with an Edit Macro dialog whose fields are all optional.
I2 zero-configKOQuick Actions and the Edit Macro dialog submitted with the default values insert {{toc/}} . On a page without headings it shows the generic "macro:toc" placeholder in the editor and renders nothing in view mode, with no hint that the table fills in once headings are added. In the editor, then in view mode: toc-empty-editor.png toc-empty-view.png
I3 instantN/A
I4 cursorN/A
I5 focusOKthe macro has no mandatory parameter, and its five fields are visible without scrolling, with the focus on the first field, Depth. The Quick Action inserts the macro without the dialog, so only the Insert Macro dialog shows it.
E1 wysiwygOK
E2 errorsKOinvalid values are accepted silently or give a message that does not name the parameter. For example, {{toc numbered="maybe"/}} is read as false, {{toc start="7"/}} renders nothing, with no message. {{toc depth="abc"/}} renders "Failed to validate bean: [must be greater than or equal to 1]", which names neither the parameter nor the fact that a number is expected, and {{toc scope="abc"/}} gives the allowed values but not the parameter name.
E3 nestingKOin a list item and in a table cell, like * {{toc/}} , the macro is inline and renders "The [toc] macro is a standalone macro and it cannot be used inline." in the editor and in view mode. Inserting it from Quick Actions at the end of a list item gives the same error and saves * two{{toc/}}((( ))) . It renders only when wrapped in a group, * two ((( {{toc/}} ))) , which the editor does not create. In a box it works.
E4 inline-supportOKthe macro declares no inline support, and its output is a nested list, which cannot be inside a sentence.
E5 emptyN/A
E6 inplaceN/A

Parameters

ParameterC1 clarityC2 mandatoryC3 defaultsC4 input-assistanceC5 groupsC6 orderC7 alternativesC8 advancedC9 technicalC13 constraintsNotes
depthOKOKOKKOOKOKN/AOKOKOK

C4: a plain text field where any text can be typed, while the value is a heading level from 1 to 6, which a select or a number field would fit.

numberedOKOKOKOKOKOKN/AOKOKN/A
referenceOKOKOKOKOKOKN/AOKOKN/A

C1: "Reference" is a technical name, but the description explains it: "Reference to the document for which to generate the table of contents. Leave empty for the current page."

C3: no default is declared, but the field opens empty, which means the current page, the value of the most common example.

scopeOKOKOKOKOKOKN/AOKOKN/A

C1: "Scope" and its values Local and Page are technical names, but the description explains them with an example: "if the macro is written in a section, only subsections of this section will be listed".

startKOOKOKKOOKOKN/AOKOKOK

C1, minor: the name "Start" does not say that it is the first heading level listed; the description "the minimum section level" does. The French name "niveau de début" is clearer.

C4: a plain text field where any text can be typed, while the value is a heading level from 1 to 6, which a select or a number field would fit.

C6: the fields are in the order depth, reference, scope, start, numbered: start comes after depth, reference and scope, although it is set together with depth. The most common example sets none of them, so the order is OK per the measure.

KOs and tickets

Every KO needs a ticket covering it, see Report the KOs. One ticket can cover several KOs. Known issues filed for this macro are suggested in italics: link them as existing tickets when they cover the KO.

KOCriterionExisting ticketsNew tickets
D2D2 summaryXWIKI-25493
D4D4 quick-actionXWIKI-25444
L2L2 doc-parametersXINFRA-525
I2I2 zero-configXWIKI-25512
E2E2 errorsXWIKI-25182 (partial)XCOMMONS-3847 (partial), XRENDERING-823 (partial), XWIKI-25512 (partial)
E3E3 nestingXWIKI-23501
C4:depthC4 input-assistance, depthXWIKI-25182
C1:startC1 clarity, startXWIKI-25493
C4:startC4 input-assistance, startXWIKI-25182
Success

Every KO is covered by a ticket.

Tickets

TicketOriginKOs coveredKOs partly covered
XWIKI-23501ExistingE3
XWIKI-25182ExistingC4:depth C4:startE2
XCOMMONS-3847NewE2
XRENDERING-823NewE2
XWIKI-25444NewD4
XWIKI-25493NewC1:start D2
XINFRA-525NewL2
XWIKI-25512NewI2E2

Known issues of this macro

No known issue is specific to this macro.
68 more known issues affect every macro: see the Known issues.

Get Connected