Template:Xtag/doc
This is a documentation subpage for Template:Xtag. It contains usage information, categories and other content that is not part of the original Template page. |
This template uses TemplateStyles: |
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.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Tag | 1 | The name of the Extension tag.
| Line | required |
Type | 2 | What type of tag to display, see documentation for possible values.
| String | optional |
Content | content | The text content of the tag. By default â...â for pair type, empty for others; unused if type is single. | Content | optional |
Parameters | params | Parameters (attributes) for the opening tag, unused in close type.
| Line | optional |
Plain display | plain | Avoid using monospace font and grey background for the tag.
| Boolean | optional |
Wrap? | wrap | Whether to not add `style="white-space: nowrap;"` to the enclosing <code> tag.
| Boolean | optional |
Parameters
[edit]- first parameter (mandatory): the name of the HTML tag
- second parameter: what type of tag to display:
p
orpair
: display a matched pair of open-and-close tags- To suppress the ellipsis which appears between the tags, add an empty
|content=
parameter
- To suppress the ellipsis which appears between the tags, add an empty
o
oropen
(default): display only the opening tag of an open-and-close pairc
orclose
: display only the closing tag of an open-and-close pairs
orsingle
: 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:
- {{xtag|templatestyles|s|params={{attr|lang|"Template:Uses TemplateStyles/example.css"}}}} →
<templatestyles src="Template:Uses TemplateStyles/example.css" />
- {{xtag|syntaxhighlight|p|params={{attr|lang|"text"}}}} →
<syntaxhighlight lang="text">...</syntaxhighlight>