displayIcon

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

Audit

Macro ID
displayIcon
Source
XS
Type
Generator
Classification reason
The macro has no content: its whole output is an icon chosen by its name parameter from the Icon Theme, so it is classified as a generator.
Status
Reviewed
Criteria version
15.20
XWiki version
18.8.0
Audit date
2026-10-19
Auditor
Compared macros
id include

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://www.xwiki.org/xwiki/bin/view/documentation/xs/user/icons/displayicon-macro/
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-platform/blob/xwiki-platform-18.8.0/xwiki-platform-core/xwiki-platform-icon/xwiki-platform-icon-macro/src/main/java/org/xwiki/icon/macro/internal/DisplayIconMacro.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, D3id, include
Other sources specific to this macro
CriterionResultNotes
D1 wordingOK"Icon" is the user's word for what the macro adds.
D2 summaryKO"Display an icon." only repeats the name, and does not say that the icon comes from the Icon Theme of the wiki. In the Quick Actions menu it sits right under the dedicated "Icon" entry, described "Embed an icon.", which inserts the same macro through an icon picker: the two descriptions do not tell the user which entry to pick.
D3 categoryOKContent, like the compared macro include; id is in Navigation since an anchor is a navigation target. The dedicated "Icon" Quick Action is listed under Content too.
D4 quick-actionKO"displayIcon" gives the macro first, and "Icon" gives it second, after the dedicated "Icon" Quick Action "Embed an icon.", which inserts the same macro. The synonyms "symbol", "pictogram", "glyph" and "picto" give no result, and "emoji" only lists the Emoji picker. The French and German names are "Icon", the same as the English one, and the French description is not translated: the French "Icône" only lists the developer widget "Sélecteur d'icônes" (Icon Picker), and the German "Symbol" only lists "Symbolauswahl", the same widget. No language of the audit instance with a different name finds the macro; the Ukrainian name "Піктограма" is the only translation that differs.
L1 consistencyOKcompared with id and include: none of them has content, and like them the macro has a mandatory target, the icon name, so its generic Quick Action and the Insert Macro dialog open the Edit Macro dialog. The dedicated "Icon" Quick Action, which inserts the macro from an icon picker, goes further than the compared macros, by design.
L2 doc-parametersOKthe new documentation lists the three parameters with the same mandatory flags and defaults as the descriptor; the default of iconSet, the Icon Theme of the wiki, is only given in the documentation, see C1 and C3 of iconSet.
L3 doc-exampleOKthe documentation gives the most common use, The {{displayIcon name="home"/}} icon links to the wiki home page. , and an example with another Icon Theme, {{displayIcon name="home" iconSet="Silk"/}} ; both render without error.
I1 patternKOcompared with children, the reference generator, and id. From the Insert Macro dialog, the Edit Macro dialog opens, as for both. From Quick Actions, "/Icon" lists two entries named "Icon": the dedicated one, "Embed an icon.", opens an inline icon autocomplete, icon::, with a preview of each icon, and inserts {{displayIcon name="home"/}} without a dialog, like the Emoji and Mention Quick Actions; the generic one, "Display an icon.", inserts the same macro through the Edit Macro dialog. Two Quick Actions entries for the same macro are uncommon: the generic one should not be listed when a dedicated entry does the same thing, see D2.
I2 zero-configOKsubmitting the Edit Macro dialog with the empty mandatory name keeps the dialog open with no message, the generic behavior of the dialog. {{displayIcon/}} typed in the source gives "Invalid macro parameters used for the [displayIcon] macro. Cause: [Property [name] mandatory]." in view mode, acceptable for a generator that needs its icon name.
I3 instantN/A
I4 cursorN/A
I5 focusOKthe mandatory Name field comes first, visible without scrolling, and has the focus when the dialog opens.
E1 wysiwygOK {{displayIcon name="home"/}} shows the same home icon in the editor and in view mode.
E2 errorsKOinvalid values are accepted silently. {{displayIcon name="nosuchicon"/}} , {{displayIcon name="fa-home"/}} and {{displayIcon name=""/}} render an empty paragraph in view mode, and the editor only shows the generic "macro:displayIcon" placeholder, with no message; the documentation even has an FAQ entry for it. {{displayIcon name="home" iconSet="NoSuchSet"/}} and the lowercase {{displayIcon name="home" iconSet="silk"/}} silently give the Silk icon of the default Icon Theme, not the Font Awesome one of the wiki, and {{displayIcon name="home" iconSet="NoSuchSet" fallback="false"/}} renders nothing at all. {{displayIcon name="home" iconSet="NoSuchSet" fallback="maybe"/}} is read as false, so it renders nothing too.
E3 nestingOKin a list item, a table cell and a box, {{displayIcon name="home"/}} renders its icon with no error, inline in the list item and the table cell, and can be edited through its dialog as at the top level.
E4 inline-supportOKthe macro declares inline support and renders inside a sentence: The {{displayIcon name="home"/}} icon links to the wiki home page. gives one paragraph, with the icon as an inline span.
E5 emptyN/A
E6 inplaceN/A

Parameters

ParameterC1 clarityC2 mandatoryC3 defaultsC4 input-assistanceC5 groupsC6 orderC7 alternativesC8 advancedC9 technicalC13 constraintsNotes
fallbackKOOKOKOKOKOKN/AOKOKN/A

C1, minor: the description says what the parameter does, but uses "icon set" for the Icon Theme, see iconSet, and "the default icon set" without saying which one it is, Silk, nor that with false nothing is displayed.

C3: the checkbox is checked, the declared default true.

C4: a checkbox, which fits a boolean.

C8: marked as advanced, and the most common example does not set it.

C9: no example of the documentation sets it, but displaying nothing rather than an icon of another Icon Theme is a realistic use, and the icon script service of XWiki, $services.icon.render(name, iconSet, fallback), exposes it to scripts.

C13: N/A, a boolean.

iconSetKOOKOKKOOKOKN/AKOOKN/A

C1: the description "The name of the icon set." uses "icon set", the historical name of what the administration and the documentation call an Icon Theme, and it does not say that an empty value takes the Icon Theme configured for the wiki, nor that the value "default" selects the Icon Theme XWiki falls back to. The German "Der Name des Icon Sets." has the same problem.

C3: the field opens empty, which stands for the Icon Theme of the wiki, the value used in most cases, like the empty language of code; the description does not explain it, see C1.

C4: a free text field, although the accepted values are the Icon Themes installed on the wiki, like "Font Awesome" and "Silk": a wrong or lowercase name, like "silk", is accepted silently, see E2. A select of the installed Icon Themes could be used.

C8, minor: taking an icon from another Icon Theme than the one of the wiki is rare, the XWiki pages that use the macro never set it outside the tests, but the field is not marked as advanced.

C9: the documentation has an example that sets it, {{displayIcon name="home" iconSet="Silk"/}} .

C13: N/A, the accepted values are a list of Icon Themes, not a range or a format; the missing select is counted under C4.

nameKOOKN/AKOOKOKN/AOKOKN/A

C1: the description "The name of the icon." only repeats the field name: it does not say that the name is one of the XWiki Icon Set, like "home" or "add", nor where to find the list.

C2: mandatory with no default, which is right: the icon to display is the whole purpose of the macro.

C4: a plain text field, so the user has to know the icon names of the XWiki Icon Set: {{displayIcon name="fa-home"/}} or a typo gives nothing, see E2. An icon picker with previews already exists, the one of the dedicated "Icon" Quick Action, and the Icon Picker widget: the dialog could use it.

C13: N/A, the accepted values are a list of icon names, not a range or a format; the missing picker is counted under C4.

C5: three fields, Name outside any group and the two others in the Optional parameters tab.

C6: Name, the only parameter set in the most common example, comes first.

Other notes

The icon has no text alternative: the Font Awesome icon is an aria-hidden span and the Silk one an image with an empty alt, and the macro has no parameter to give one, so an icon that carries meaning, like a status, is not announced by screen readers. With the fallback to the default Icon Theme, {{displayIcon name="home" iconSet="NoSuchSet"/}} , the image gets its URL as alt text. Bugs outside the criteria, to file in JIRA.

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-23787 (partial)XWIKI-25485 (partial)
D4D4 quick-actionXWIKI-23787 (partial)XWIKI-25444
I1I1 patternXWIKI-23787
E2E2 errorsXWIKI-20875 (partial)XCOMMONS-3847 (partial), XRENDERING-823 (partial), XWIKI-25583 (partial)
C1:fallbackC1 clarity, fallbackXWIKI-25485
C1:iconSetC1 clarity, iconSetXWIKI-25485
C4:iconSetC4 input-assistance, iconSetXWIKI-20875
C8:iconSetC8 advanced, iconSetXWIKI-25486
C1:nameC1 clarity, nameXWIKI-25485
C4:nameC4 input-assistance, nameXWIKI-20874
Success

Every KO is covered by a ticket.

Tickets

TicketOriginKOs coveredKOs partly covered
XWIKI-20874ExistingC4:name
XWIKI-20875ExistingC4:iconSetE2
XWIKI-23787ExistingI1D2 D4
XCOMMONS-3847NewE2
XRENDERING-823NewE2
XWIKI-25444NewD4
XWIKI-25485NewC1:fallback C1:iconSet C1:nameD2
XWIKI-25486NewC8:iconSet
XWIKI-25583NewE2

Known issues of this macro

IssueTitleStatusCriteria
XWIKI-20875Icon macro should use a list of existing Icon sets as parameter instead of inputOpenC4
XWIKI-23787Remove the quick action for the displayIcon macroOpenD4

68 more known issues affect every macro: see the Known issues.

Get Connected