Help:XML-style tags
XML-style tags use a syntax such as <
tagname attribute1="value1" attribute2="value2">
content </
tagname >
.
Parser extension tags[edit]
On any MediaWiki wiki Special:Version shows the parser extension tags available on that wiki, in alphabetical order. MediaWiki versions of Wikimedia projects gives these links for all Wikimedia wikis on one page.
For Meta this is the following list:
<categorytree>, <charinsert>, <dynamicpagelist>, <gallery>, <hiero>, <imagemap>, <inputbox>, <math>, <nowiki>, <poem>, <pre>, <ref>, <references>, <section>, <source>, <syntaxhighlight> and <timeline>
On the English Wikipedia the list is the same, except that it is without <dynamicpagelist> and <section>.
Also a list of installed parser hooks is given, which also determine the parser extension tags in addition to the standard tags ("core tag hooks"), which are <gallery>, <math>, <nowiki>, and <pre> (and <html> if raw HTML is allowed) [1]
- <categorytree mode="..." hideprefix="..." ...> with several other attributes: see mw:Extension:CategoryTree
- <charinsert>: see mw:Extension:CharInsert
- <dynamicpagelist> (not on the English Wikipedia): see mw:Extension:DynamicPageList (Wikimedia) and n:DynamicPageList
- <gallery caption="..." widths="..." heights="..." perrow="...">: see Help:Images and other uploaded files#Gallery
- <hiero>: see mw:Extension:WikiHiero
- <imagemap>: see mw:Extension:ImageMap
- <inputbox>: see mw:Extension:InputBox
- <math>: see Help:Displaying a formula; provided in the MediaWiki distribution, but requires separate installation, see mw:Manual:Math
- <nowiki> and <pre>: see Help:Advanced editing#Disabling wikitext interpretation and/or reformatting, Help:Expansion#Intermediate results and mw:Markup spec/BNF/Noparse-block
- <poem>: see mw:Extension:Poem
- <ref name="...">, <references>: see Help:Footnotes and mw:Extension:Cite/Cite.php
- <section begin="...">, <section end="...">: see Help:Template#Labeled section transclusion and mw:Extension:Labeled Section Transclusion
- <source lang="..."> (not on the English Wikipedia): see mw:Extension:ASHighlight
- <syntaxhighlight lang="...">: see mw:Extension:SyntaxHighlight GeSHi
- <timeline>: see mw:Extension:EasyTimeline/syntax
Tag function[edit]
Calls of the parser function #tag can be of one of the following forms:
{{#tag:
tagname|
content}}
{{#tag:
tagname|
content|
attribute1=value1}}
{{#tag:
tagname|
content|
attribute1=value1|
attribute2=value2}}
- etc.
After identifying the wikitexts for the content, the attribute names and the values, each is expanded. If the name attribute1 is the same as the name attribute2 then value1 is discarded (like in a template call, but unlike in #switch, where "a=b|a=c" is equivalent with "a=b"). Finally,
{{#tag:
tagname}}
{{#tag:
tagname||
attribute1=value1}}
{{#tag:
tagname||
attribute1=value1|
attribute2=value2}}
{{#tag:
tagname|
content}}
{{#tag:
tagname|
content|
attribute1=value1}}
{{#tag:
tagname|
content|
attribute1=value1|
attribute2=value2}}
- etc.
are expanded to, respectively:
<
tagname/>
<
tagname attribute1="value1"/>
<
tagname attribute1="value1" attribute2="value2"/>
<
tagname>
content</
tagname>
<
tagname attribute1="value1">
content</
tagname>
<
tagname attribute1="value1" attribute2="value2">
content</
tagname>
- etc.
Note that content has a fixed position after the first "|", and "=" inside its expanded wikitext has no special meaning in this expansion step, so regardless of whether it contains "=", the whole text is taken. A "|" in content must be entered as {{!}}, except in e.g. [[...|...]]; thus e. g. an external link in timeline can be entered in the form [...{{!}}...].
The tag function can be a useful alternative of the XML-style tag pair itself, which does not expand the wikitexts for the content and the attribute names and values. With the tag fuction they can contain parameters, variables, parser functions and templates. For nowiki and pre the choice depends on the desired effect. For most other extensions the tag function is more versatile. A disadvantage can be that double braces intended for the expanded wikitext of content can affect the parsing of the tag function call. Such double braces could be in the TeX code for the math extension; they can be avoided without affecting the result by a space between the two braces. For a tag without content and without attributes such as <references/>
the slightly longer {{#tag:references}}
has hardly advantages.
Other[edit]
- <noinclude>, <includeonly>, <onlyinclude>: see Help:Template#Noinclude, includeonly, and onlyinclude
- Most ‘safe’ HTML tags: 'b', 'del', 'i', 'ins', 'u', 'font', 'big', 'small', 'sub', 'sup', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'cite', 'code', 'em', 's', 'strike', 'strong', 'tt', 'var', 'div', 'center', 'blockquote', 'ol', 'ul', 'dl', 'table', 'caption', 'pre', 'ruby', 'rt' , 'rb' , 'rp', 'p', 'span', 'u', 'br', 'hr', 'li', 'dt', 'dd', 'td', 'th', 'tr', see Help:HTML in wikitext
- <!-- ... -->: see Help:Comment tags and mw:Markup spec/BNF/Noparse-block#HTML-comment
See also[edit]
Notes[edit]
Links to other help pages
- Help contents
- Meta · Wikinews · Wikipedia · Wikiquote · Wiktionary · Commons: · Wikidata · MediaWiki · Wikibooks · Wikisource · MediaWiki: Manual · Google
- Versions of this help page (for other languages see further)
- What links here on Meta or from Meta · Wikipedia · MediaWiki
- Reading
- Go · Search · Namespace · Page name · Section · Backlinks · Redirect · Category · Image page · Special pages · Printable version
- Tracking changes
- Recent changes (enhanced) | Related changes · Watching pages · Diff · Page history · Edit summary · User contributions · Minor edit · Patrolled edit
- Logging in and preferences
- Logging in · Preferences
- Editing
- Starting a new page · Advanced editing · Editing FAQ · Export · Import · Shortcuts · Edit conflict · Page size
- Referencing
- Links · URL · Piped links · Interwiki linking · Footnotes
- Style and formatting
- Wikitext examples · CSS · Reference card · HTML in wikitext · Formula · Lists · Table · Sorting · Colors · Images and file uploads
- Fixing mistakes
- Show preview · Reverting edits
- Advanced functioning
- Expansion · Template · Advanced templates · Parser function · Parameter default · Magic words · System message · Substitution · Array · Calculation · Transclusion
- Others
- Special characters · Renaming (moving) a page · Preparing a page for translation · Talk page · Signatures · Sandbox · Legal issues for editors