Template:Xtag/doc

For the page status indicator Phabricator tags, see: {{Ptag}}.

This is the TemplateData documentation for this template used by VisualEditor and other tools.

Extension tag

This template adds a formatted MediaWiki parser or extension tag that links to the help or extension page. This template is similar to {{tag}}, but it links the tag and defaults to open.

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Tag1

The name of the Extension tag.

Default
tag
Example
pre
Linerequired
Type2

What type of tag to display, see documentation for possible values.

Suggested values
p pair o open c close s single
Default
open
Stringoptional
Contentcontent

The text content of the tag. By default “...” for pair type, empty for others; unused if type is single.

Contentoptional
Parametersparams

Parameters (attributes) for the opening tag, unused in close type.

Example
{{attr|foo|"bar"}}
Lineoptional
Plain displayplain

Avoid using monospace font and grey background for the tag.

Default
0
Auto value
1
Booleanoptional
Wrap?wrap

Whether to not add `style="white-space: nowrap;"` to the enclosing <code> tag.

Default
0
Auto value
1
Booleanoptional

Parameters

edit
  • first parameter (mandatory): the name of the HTML tag
  • second parameter: what type of tag to display:
    • p or pair: display a matched pair of open-and-close tags
      • To suppress the ellipsis which appears between the tags, add an empty |content= parameter
    • o or open (default): display only the opening tag of an open-and-close pair
    • c or close: display only the closing tag of an open-and-close pair
    • s or single: display a single tag
  • content= the text content of the tags
  • params= any parameters to be included in the opening tag

Examples

edit
Markup Renders as
{{xtag|nowiki}}
‎<nowiki>
{{xtag|nowiki|close
| content = <nowiki>{{{content}}}</nowiki>
| params  = {{attr|foo|"bar"}}
}}
{{{content}}}‎</nowiki>
{{xtag|nowiki|single
| content = <nowiki>{{{content}}}</nowiki>
| params  = {{attr|foo|"bar"}}
}}
‎<nowiki foo="bar" />
{{xtag|nowiki|open
| content = <nowiki>{{{content}}}</nowiki>
| params  = {{attr|foo|"bar"}}
}}
‎<nowiki foo="bar">{{{content}}}
{{xtag|nowiki|pair
| content = <nowiki>{{{content}}}</nowiki>
| params  = {{attr|foo|"bar"}}
}}
‎<nowiki foo="bar">{{{content}}}‎</nowiki>

Markup → Renders as:

See also

edit