Jump to content
šŸ—³ļøšŸ–„ļø The Wikimedia Foundation December 2024 Developer Satisfaction Survey closes on the 2025-01-03. This survey helps us measure developer satisfaction, and prioritize work on tools and platforms for our technical contributors.

Template:Tag

From wikiNonStop
Revision as of 00:16, 29 November 2024 by en>ExE Boss (UseĀ {{Yesno}} andĀ TemplateStyles (matchĀ {{xtag}}))
(diff) ā† Older revision | Latest revision (diff) | Newer revision ā†’ (diff)

‎<tag>...‎</tag>

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

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

Tag

This template provides a quick way to mention an XML-style tag in a preformatted way. Mainly used in discussion/help pages.

Template parameters[Edit template data]

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Tag1

The name of the HTML tag.

Default
tag
Example
span
Linerequired
Type2

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

Suggested values
p pair o open c close s single
Default
pair
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
foo="bar"
Lineoptional
Plain displayplain

Avoid using monospace font and grey background for the tag.

Booleanoptional
Wrap?wrap

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

Auto value
1
Booleanoptional

Usage

Types

  • p or pair ā€“ (default) display a matched pair of open-and-close tags: ‎<div>...‎</div>
  • o or open ā€“ display only the opening tag of an open-and-close pair: ‎<span>
  • c or close ā€“ display only the closing tag of an open-and-close pair: ‎</span>
  • s or single ā€“ display a single tag: ‎<br />

Examples

  • {{tag|ref}} ā†’ ‎<ref>...‎</ref>
  • {{tag|ref|content=hello}} ā†’ ‎<ref>hello‎</ref>
  • {{tag|span|content=foo}} ā†’ ‎<span>foo‎</span>
  • {{tag|span|open}} ā†’ ‎<span>
  • {{tag|span|open|content=hello}} ā†’ ‎<span>hello
  • {{tag|span|close|content=hello}} ā†’ hello‎</span>
  • {{tag|span|pair|content=hello}} ā†’ ‎<span>hello‎</span>
  • {{tag|ref|open|params={{attr|group|"note"}}}} ā†’ ‎<ref group="note">
  • {{tag|references|single}} ā†’ ‎<references />
  • {{tag|br|single}} ā†’ ‎<br />

See also