<tag </tag>
![]() | This is the template sandbox page for Template:Tag (diff). See also the companion subpage for test cases. |
![]() | This template is used on approximately 6,900 pages and changes may be widely noticed. Test changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Consider discussing changes on the talk page before implementing them. |
{{tag|tagname [|type] [|content=text] [|attribs=attributes and values]}}
A markup tag is an open < and a close > angle brackets and the content within them, in a markup language, as XML or HTML:
- For example, the <title> tag provides a title for the Web page.
This template provides a quick way to mention a markup-style tag in a preformatted way. Mainly used in discussion/help pages.
Parameters
editThis template is for 'displaying' HTML/XML markup tag code and can. contain contents between the start and end tags amongst other options. (Note: For 'using' markup tags, use the #tag magic word.)
Parameter | Description | Type | Status | |
---|---|---|---|---|
Tag name | 1 | XML/HTML tag's name. Use !-- for an HTML comment.
| String | required |
Type | 2 | To indicate which of the tag's types is/are presented. For example, using "open" → <span>; "close" → </span>; "empty" → <br />. To suppress the ellipsis ("...") between the tags, add an empty "content" parameter → <span></span>
| String | suggested |
Disable nowrap | wrap | Disable nowrap for long samples, so allowing wraps (line breaks or newlines).
| Boolean | optional |
CSS style | style | Replace the default CSS style: border:none; background:transparent.
| String | optional |
Link? | link | Link to the element's entry in the [[HTML element]] article, For example: {{Tag | del | link=y}} produces: "<[[HTML element#del | del]]>...</del>". This is only for HTML elements; the page for the link is hard-coded.
| Unknown | optional |
params | params | no description | Unknown | optional |
Attributes and values | attribs params | [[Attributes and values]] to be included as part of an open/start tag
| String | suggested |
Content | content | Text to place between open/start and close/end tags. | String | suggested |
Global use and documentation
editFor a global use of this template in other sister or Wikimedia projects, after copying it to paste in the destination project, remember to change in the code:
|p|pair = <{{#if:{{{link|}}}|[[HTML element#
by this one:
|p|pair = <{{#if:{{{link|}}}|[[Wikipedia:en:HTML element#
Remark that the code Wikipedia:en:
has been added.
For template documentation in the sister project, you can use Template:Wikipedia doc.
See also
edit- HTML tag
- {{HTMLElement}}
- {{XMLElement}}
- {{xtag}} adds a MediaWiki parser or extension tag that links to the extension page.
- #tag:, the parser function that generates working tags.
Other formatting templates
editCode example | Effect | Notes |
---|---|---|
{{Tj|Hatnote|Some text|selfref: yes|category: no|lang: fr}}
|
Supports colors, placeholder texts, named and unnamed parameters | |
<syntaxhighlight lang="wikitext">
{{Hatnote
| Some text
| selfref = yes
| category = no
| lang = fr
}}
</syntaxhighlight>
|
{{Hatnote
| Some text
| selfref = yes
| category = no
| lang = fr
}}
|
Same as above |
{{Tji|Hatnote|Some text|selfref: yes|category: no|lang: fr}}
|
{{Hatnote |
Supports colors, placeholder texts, named and unnamed parameters |
|
{{Hatnote|Some text|selfref=yes|category=no|lang=fr}}
|
Same as above |
{{tl2|Hatnote|lang=fr}}
|
{{hatnote}} |
Supports linking to sister projects (e.g., fr:Hatnote) |
{{demo|<nowiki>{{Hatnote|Some text}}</nowiki>}}
|
{{hatnote|Some text}}
|
Shows code and example |
{{tln|Hatnote}}
|
Template:Hatnote | Produces a normal link to the template |
{{elc|Template:Example}} {{elc|Template:Example|Text|suffix}}
|
[[Template:Example]] [[Template:Example|Text]]suffix |
Shows how wikilink would be entered in wiki markup, with optional link text and suffix |
{{ml|Example|hello}}
|
{{#invoke:Example|hello}} | Counterpart to {{tl}} for linking to Lua modules |
{{mfl|Example|hello}}
|
{{#invoke:Example|hello}} | Similar to {{ml}}, but expects the function to be documented and creates a link to the corresponding section |
{{mlx|Example|hello}}
|
{{#invoke:Example|hello}} |
Counterpart to {{tlx}} for linking to Lua modules |
{{ml-lua|Module:Example}}
|
require('Module:Example') |
Link to Lua modules and built-in libraries, showing Lua code. |
{{para|title|<var>book title</var>}}
|
|title=book title |
Formats template parameters for display, with or without values |
{{sclx|LASTING}}
|
[[WP:LASTING]] |
Takes a shortcut suffix in project namespace and displays it with brackets and the WP: alias in a <code>...</code> tag.
|
{{tag|ref}} {{xtag|templatedata}}
|
<ref>...</ref> <templatedata> |
Formats [X]HTML tags; can add content, choose opening, closing, or self-closing |
{{dtl|Ping project}}
|
{{d:Ping project}} | Wikidata counterpart to {{tl}} |
{{pf|if}} {{pf|if|{{{1}}}|true|false}}
|
{{#if}} {{#if:{{{1}}}|true|false}} |
Parser function equivalent to {{tl}} |
{{magic word|uc:}}
|
{{uc:}} | Magic word links |
This template is for 'displaying' HTML/XML markup tag code and can. contain contents between the start and end tags amongst other options. (Note: For 'using' markup tags, use the #tag magic word.)
Parameter | Description | Type | Status | |
---|---|---|---|---|
Tag name | 1 | XML/HTML tag's name. Use !-- for an HTML comment.
| String | required |
Type | 2 | To indicate which of the tag's types is/are presented. For example, using "open" → <span>; "close" → </span>; "empty" → <br />. To suppress the ellipsis ("...") between the tags, add an empty "content" parameter → <span></span>
| String | suggested |
Disable nowrap | wrap | Disable nowrap for long samples, so allowing wraps (line breaks or newlines).
| Boolean | optional |
CSS style | style | Replace the default CSS style: border:none; background:transparent.
| String | optional |
Link? | link | Link to the element's entry in the [[HTML element]] article, For example: {{Tag | del | link=y}} produces: "<[[HTML element#del | del]]>...</del>". This is only for HTML elements; the page for the link is hard-coded.
| Unknown | optional |
params | params | no description | Unknown | optional |
Attributes and values | attribs params | [[Attributes and values]] to be included as part of an open/start tag
| String | suggested |
Content | content | Text to place between open/start and close/end tags. | String | suggested |