Help:Wikitext

Wikitext, also known as Wiki markup or Wikicode, consists of the syntax and keywords used by the MediaWiki software to format a page. To learn how to see this hypertext markup, and to save an edit, see Help:Editing. Generally, coding can be copied and pasted, without writing new code. There is a short list of markup and tips at Help:Cheatsheet.

In addition to Wikitext, some HTML elements are also allowed for presentation formatting. See Help:HTML in wikitext for information on this.

Sections in a page will follow the page's lead/introduction, and under certain conditions, the table of contents.

The horizontal rule represents a paragraph-level thematic break. Do not use in article content, as rules are used only after main sections, and this is automatic.

When a page has at least four headings, a table of contents (TOC) will automatically appear after the lead and before the first heading. The TOC can be controlled by magic words or templates:

Line breaks or newlines are used to add whitespace between lines, such as separating paragraphs.

When there is a need for separating a block of text. This is useful for (as the name says) inserting blocks of quoted (and cited) text.

Do not leave blank lines between items in a list unless there is a reason to do so, since this causes the MediaWiki software to interpret each item as beginning a new list.

To list terms and definitions, start a new line with a semicolon (;) followed by the term. Then, type a colon (:) followed by a definition. The format can also be used for other purposes, such as make and models of vehicles, etc.

Description lists (formerly definition lists, and a.k.a. association lists) consist of group names corresponding to values. Group names (terms) are in bold. Values (definitions) are indented. Each group must include one or more definitions. For a single or first value, the : can be placed on the same line after ; – but subsequent values must be placed on separate lines.

Do not use a semicolon (;) simply to bold a line without defining a value using a colon (:). This usage renders invalid HTML5 and creates issues with screen readers.

Frère Jacques, frère Jacques,
Dormez-vous? Dormez-vous?
Sonnez les matines! Sonnez les matines!
Ding, dang, dong. Ding, dang, dong.

Are you sleeping? Are you sleeping?
Brother John, Brother John,
Morning bells are ringing! Morning bells are ringing!
Ding, dang, dong. Ding, dang, dong.

Special characters can often be displayed using numeric character references or character entity references. See Character encodings in HTML for more information. For example, À and À both render À (A-grave). Percent-encoding can't be used, as it works only in URLs.

WikiHiero is a software extension that renders Egyptian hieroglyphs as PNG images using <hiero> tags.

Characters in the Private Use Area, and invisible formatting characters

In Wikipedia and some other wikis, free links are used in wikitext markup to produce internal links between pages, as opposed to the concept of CamelCase for the same purpose, which was used in the early days of Wikipedia – see CamelCase and Wikipedia.

In Wikipedia's markup language, you create free links by putting double square brackets around text designating the title of the page you want to link to. Thus, [[Texas]] will be rendered as Texas. Optionally, you can use a vertical bar (|) to customize the link title. For example, typing [[Texas|Lone Star State]] will produce Lone Star State, a link that is displayed as "Lone Star State" but in fact links to Texas.

Magic links are automatic links for certain unique identifiers that require no markup. They can be used for ISBN numbers, RFC numbers, and PMID numbers.

It is often desirable to provide an aid to pronunciation for a word. The IPAc-en and Respell templates can be of assistance.

Refer to Wikipedia:Manual of Style (pronunciation) for more information.

Musical notation is added by using the <score>...</score> extension tag. For example:

Only images that have been uploaded to Wikipedia or Wikimedia Commons can be used. To upload images, use the Commons upload wizard for photos you have taken, and the Wikipedia upload page if there may be copyright issues. You can find the uploaded image on the image list.

See the Wikipedia's image use policy for the policy used on Wikipedia.

For further help on images, including some more versatile abilities, see the picture tutorial and extended image syntax.

Making a reference citing a printed or online source can be accomplished by using the <ref>...</ref> tags. Inside these tags details about the reference are added.

Details about the citation can be provided using a structure provided by various templates; the table below lists some typical citation components.

There are three pairs of tags that can be used in wikitext to control how transclusion affects parts of a template or article. They determine whether or not wikitext renders, either in its own article, which we will call "here", or in another article where it is transcluded, which we will call "there".

There can be several such section "elements". Also, they can be nested. All possible renderings are achievable. For example, to render there one or more sections of the page here use <onlyinclude> tags. To append text there, wrap the addition in <includeonly> tags before, within, or after the section. To omit portions of the section, nest <noinclude> tags within it.

If a page is transcluded without transclusion markup, it may cause an unintentional categorization. Any page transcluding it will contain the same category as the original page. Wrap the category markup with <noinclude> tags to prevent incorrect categorization. Some templates take parameters, as well, which you separate with the pipe character |.

Note: <s></s> and <u></u> (speced in HTML 3 & 4) are considerably more popular than <del></del> and <ins></ins> (speced in HTML 5) on Wikipedia.

A few different kinds of formatting will tell the wiki to display things as you typed them – what you see is what you get!

In order for the software to interpret wiki markup, its parser first scans the page. When it sees its nowiki tags

it escapes its wikicode, so editors can document its markup using its markup.

The two kinds of nowiki operate in different ways to target content, but they both remove meaning (subtract rendering) of wiki markup, then disappear into the background font. Nowiki does nothing toward rendering, but it can add newlines to wikitext (for readability), just like the HTML comment (the preferred method) can. Unlike wiki markup, nowiki does not remove the meaning of character entities, either HTML or MediaWiki special characters.

There is only one meaning for what <nowiki>...</nowiki> contains, so it needs few examples; but the singular <nowiki /> tag "contains" many linkage structures, where it is expected between bracketing-pair characters or in the keyword area. So this section has many examples and few mis-examples.

For example, only at the beginning of a line (bol of wikitext, bol in a transclusion, or beginning of a table cell), do *, #, ; or : mean something.

[[ wp:pagename | page name ]]
[<nowiki />[ wp:pagename | page name ]]
[[<nowiki /> wp:pagename | page name ]]
[[ wp:pagename <nowiki />| page name ]]
[[ wp:pagename | page name ]<nowiki />]

page name
[[ wp:pagename | page name ]]
[[ wp:pagename | page name ]]
[[ wp:pagename | page name ]]
[[wp:pagename | page name ]]

For nested structures, escaping an inner structure escapes its outer structure too.

For templates, put nowiki before the first pipe. If a parameter has a wikilink, put it in that, an inmost position.

For a parser function nowiki goes between bracketing-pair characters, or anywhere before the : colon.

<tags> do not display; they are just markup. If you want them to, insert <nowiki /> after an < opening angle bracket; it goes only in the very front. Opening tags and closing tags must be treated separately.

<span style=color:blue> Blue </span>
<<nowiki />span style=color:blue> Blue <<nowiki />/span>
<section end=la<nowiki />bel /> 

Character entities, nowiki cannot escape. To escape HTML or special character entities, replace & with &amp;. For example, &amp;lt;&lt;

<nowiki>...</ nowiki >
< nowiki>...</ nowiki >
< nowiki>...</ nowiki >

Nowiki tags do not otherwise nest, so it is the second and fourth that displays:

These simply scan from left to right. The paired tags cannot overlap, because the very first pair-match nullifies any intervening tags inside. Unbalanced tags always display.

<pre> is a parser tag that emulates the HTML <pre> tag. It defines preformatted text that is displayed in a fixed-width font and is enclosed in a dashed box. HTML and wiki markups are escaped and spaces and line breaks are preserved, but HTML entities are parsed.

<pre> formatted text does not wrap, thus text may extend past the browser window:

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

To resolve this, <pre> may use CSS styling to add wrapping or a horizontal scrollbar:

As <pre> is a parser tag, it escapes wikitext and HTML tags. This can be prevented with the use of <includeonly></includeonly> within the <pre>, making it act more like its HTML equivalent:

Invisible HTML <pre> tags can also be inserted by preceding text with a space character, like:

It's uncommon – but on occasion acceptable for notes to other editors – to add a hidden comment within the text of an article. These comments are visible only when editing or viewing the source of a page. Most comments should go on the appropriate Talk page. The format is to surround the hidden text with "<!--" and "-->" and may cover several lines, e.g.:

<!-- An example of hidden comments This won't be visible except in "edit" mode. -->

Many HTML tags can be used in wiki markup. You can check your HTML by using markup validation.

See the 'Coding wiki markup' section of the Help navigation navbox below for additional links.