MediaWiki User Guide/Print version

This is a user guide to MediaWiki, the software that runs Wikipedia, Wikibooks and other Wikimedia projects. The book focuses on Mediawiki markup. Topics out of scope of the book include administration and development of Mediawiki.

Text Formatting

The following is an overview of text formatting available in Mediawiki:

Basic text formatting
Formatting Markup Note
Boldface '''text'''
Italics ''text''
Boldface and italics '''''text'''''
Boldface combined with wikilink '''[[text]]''' The reverse order of ticks and brackets does not work: [['''text''']]

Other text formatting such as underline or blockquote needs to be done using HTML tags, including U for underline, TT for typewriter text, S for strikethrough, SUB for lower index and SUP for upper index.


Text formatting can also be done using HTML and CSS. Some of the most useful HTML elements are:

Most needed HTML markup
Task Markup Note
Preformatted text
The effect in wiki differs from the one in HTML; in wiki, the text within the PRE element is treated as within NOWIKI element, leaving all the HTML and wiki markup uninterpreted.
<blockquote>Longer passage.</blockquote>
<!-- comment -->
Avoid nesting, such as
<!-- <!-- comment --> -->
Generic inline element
<span style="TODO"></span>
Can be styled arbitrarily using cascading style sheets - CSS.
Generic block element
<div style="TODO"></div>
Can be styled arbitrarily using cascading style sheets - CSS.

Some HTML elements are not allowed, such as A and IMG.

Source code

Source code of various programming and markup languages can be formatted using <syntaxhighlight> element, which leads to colored syntax of the code.

An example of wiki markup:

<syntaxhighlight lang="html4strict">
    <p>Hello <span style="font-weight: bold;">world</span>!

The rendering of that markup:

    <p>Hello <span style="font-weight: bold;">world</span>!


There are two types of hyperlinks in MediaWiki: internal, also called wikilinks, and external.

Task Markup Note
Internal hyperlink [[keyword]]
Internal hyperlink 2 [[keyword]]s
Internal hyperlink to a section [[keyword#section_heading|link title]]
Internal hyperlink showing a different word [[keyword|its appearance]]
Internal hyperlink with a tooltip [[keyword|<span title="A tooltip">its appearance</span>]]
Internal hyperlink in bold '''[[keyword]]'''
Internal hyperlink to a diff/edit [[Special:Diff/(diff-number)]]
Internal hyperlink to a revision [[Special:Permalink/(revision-number)]]
Task Markup Note
External hyperlink [URL_containing_no_spaces title of the URL]


Readers and editors from different backgrounds search for the same topic under different titles, such as TODO. To avoid replication of similar content and confusion of editors and readers, the editors of a wiki website usually choose one topic title as the authorized one, under which the content is to be created, and let one or more alternative topic titles redirect to it.

To let a page title redirect to another one, create a page with the unauthorized (or minor) title, containing only the following text:

#REDIRECT [[Authorized topic title]]

An alternative markup; notice the additional colon (":"):

#REDIRECT: [[Authorized topic title]]

If an unauthorized topic title has more possible target authorized topic titles, redirecting does not do. In that case, a disambiguation page can be created, such as:

 The term '''unauthorized term''' may refer to:
 * [[Authorized topic title 1]]
 * [[Authorized topic title 2]]

The exact wording depends on the kind of content of the wiki website.

Further reading

Sections and Headings

Headings are created using sequences of "=" characters, placed before the heading title and after the heading title, on the same line. The level of headings is determined by the number of "=" characters.


Level Example
2. ==Plants==
3. ===Plants===
4. ====Plants====

Start level: 2

Do not use headings of level 1, such as "=Title="; start with level 2 instead. The heading at level 1 is used for the title of the page.

Maximum level: 6

The maximum level of a heading is 6, rendered using ======Heading L6======. Entering a heading with 7 equals-signs such as =======Heading L7======= results in the creation of a heading of the level 6, with one equal-sign becoming part of the text of the heading: "=Heading L7=".


Depending on the convention that users and editors adopt, there can be any number of spaces between the "=" characters and the title.

An example without spaces:


An example with spaces:

== Plants ==

Table of contents

By default, the titles of headings appear in the table of contents, shown at the top of the page. To prevent having a table of contents, put the "__NOTOC__" sequence of characters into the page. To force the presence of table of contents on a specific place of the page, use "__TOC__".

Headings not in TOC

There is no simple way to make a heading not appear in the table of contents, and this was stated as being by design. It may, however, be possible to write a small custom extension to enable this functionality.

Customizing TOC

There are various ways how to customize the table of contents. For instance, to place it to the right, use:

<div style="float:right; clear:both; margin-left:0.5em;">__TOC__</div>

Editability of sections

By default, all sections are editable separately, without the need to see the complete text of the page.

To make all the sections on a page non-editable, place __NOEDITSECTION__ anywhere on the page.

There is no simple way to make a single section non-editable, AFAIK.


Lists formatting:

Bullet lists:

Example Syntax Example Output
* a
** b
** c
*** d
  • a
    • b
    • c
      • d

Numbered lists:

Example Syntax Example Output
# a
## b
## c
### d
  1. a
    1. b
    2. c
      1. d

Definition lists:

Example Syntax Example Output
; defined term : definition
; defined term 2 : definition 2
defined term
defined term 2
definition 2

Mixed lists:

Example Syntax Example Output
 * a
 *# b
 *# c
  • a
    1. b
    2. c

Lists inside tables:

Example Syntax Example Output
{| class="wikitable"
! Heading a
! Heading b
* a1
* a2
Column1 Heading Column2 Heading
  • r1c1
  • r1c2
  • r2c1
  • r2c2



|+ Caption of the table
! Heading 1
! Heading 2
| Cell 1 in row 1
| Cell 2 in row 1
| Cell 1 in row 2
| Cell 2 in row 2

Dense format:

|+ Caption of the table
! Heading 1
! Heading 2
| Cell 1 in row 1 || Cell 2 in row 1
| Cell 1 in row 2 || Cell 2 in row 2

Lists in tables:

! Heading a
! Heading b
* a1
* a2



Mediawiki supports the use of images in various formats. In order to be used in a wiki, image first needs to be uploaded, to which we come later.

Placing images

The following is an overview of placing images into pages, such images that have already been uploaded.

Placing of images
Task Markup Default Frame Note
Image [[Image:image_name.png]] No The image is shown in its full size as found in the file.
Image with thumb [[Image:image_name.png|thumb|A caption text of the image.]] Yes Thumbs are always scaled down so as not to exceed an upper limit on the size.
Image without thumb, with restricted size [[Image:image_name.png|150px]] No


  • 'right'
  • 'left'
  • 'center'
  • 'none'


Images can be put into a gallery as follows. Notice the absent "[[" and "]]" around the names of the image files.


Images in galleries can be given captions, as follows.

Image:name_1.png | Caption 1.
Image:name_2.jpeg | Caption 2.

Uploading images


To do:
Create this section.


Pages in wiki can be put into categories, by placing a category assignment anywhere in them. An example:


Categories have their own namespace "Category:", and are pages of sorts too. A category can be put into another category, so the categories can form a hierarchy or other structures.

A list of uncategorized pages can be shown by Mediawiki software.

Without extensions there is no easy way to rename a category; all its pages need to be edited and the line of category assignment changed. For a bulk category change you can use Replace Text extension.


A wikilink to a category needs to start with ":", such as

See also [[:Category:Birds]]

Otherwise, the page is put into the category instead of linking to it, and the wikilink is not shown.


Categories can be used in templates, just like in mainspace pages. However, when you put a category assignment into a template, all the pages using that template become a member of that category. That is sometimes the required effect, but it may be unwanted, for instance when you want to categorize the templates rather than the pages that use the templates. For that case, embrace the category assignment into <noinclude> tag, such as:

[[Category:Maintenance templates]]


Templates provide a means to repeat the same text on several pages. More advanced templates make use of parameters, and even of control structures as found in programming languages. That said, basic templates are quite easy to create, requiring no knowledge of programming.

Templates have their own "Template:" namespace.

To create a template called "header", edit the page "Template:header" and place the text to be repeated into that template.

To use the template in a page, type "{{header}}". What marks the use of the template are the "{" and "}" characters, also known as curly brackets.

To replace the name of the template with its contents directly in the source wikitext before the text is saved, use "{{subst:header}}".


Templates can have unnamed and named parameters. The unnamed parameters are automatically numbered.

To use an unnamed parameter inside a template, refer to it using {{{1}}}, {{{2}}}, and the like. Notice the three curly brackets.

To use a named parameter inside a template, refer to it using the same curly brackets and the name, instead of a number, like {{{parameter_name}}}.

To pass a parameter to a template when you use it in a mainspace page:


To pass equality sign (=) in the value of an unnamed parameter, you need a workaround: use, for the parameter number one, {{template|1=text=with=equality=sign}}.


Templates that are to be used by many users are worth documenting. One option is to document them on their talk pages. Another is to document them in their main text, and surround the documentation with <noinclude> tag. A plus side of the second option is that users who want to learn how the template works can see its syntax on the same view as the template if they are experimenting with its code.

Control structures

Control structures such as if and switch are available, if the ParserFunctions extension of MediaWiki is installed.

Overview of control structures
Keyword Syntax Note
{{#switch: <comparison value>
 | <value1> = <result1>
 | <value2> = <result2>
 | ...
 | <valuen> = <resultn>
 | <default result>
{{ #if: <condition string> | <code if true> }}
{{ #if: <condition string> | <code if true>
                           | <code if false> }}
The condition string is considered true if it is non-empty and not consisting only of whitespace.
{{ #ifeq: <text 1> | <text 2> | <code if equal> }}
{{ #ifeq: <text 1> | <text 2> | <code if equal>
                              | <code if not equal> }}
{{ #ifexist: <page name> 
             | <wikitext if page exists>
             | <wikitext if page does not exist> }}

Further reading:

Transcluding any page

Above, you have learned how to use a template, that is, to let MediaWiki replace the name of the template surrounded by curly brackets with the contents of the template. In similar fashion, you can transclude any page, not just a template, by writing the following:


This works for pages in the mainspace. To include any page in any namespace, use:


The use of a template is in fact a special case of this use, just that, as you do not specify any namespace, the Template namespace is used as the default one.

This does not work with some namespaces, such as the Special and Category namespaces.


The method of using templates described in the preceding sections leads to an inclusion of templates, meaning that the source text of the page contains the name of the template surrounded by curly bracket, not its content. There is however another use of templates, in which the content of the template is written directly into the wiki page before the page is saved. This use is called substitution and is achieved as follows:


In a more advanced use, it may be required that control structures such as #if that are present in the substituted template are substituted too, which would seem to be achieved using {{subst:#if ...}}. However, this would lead to a substitution at the time of saving the template, which is undesirable. A solution: {{<includeonly></includeonly>subst:#if ...}}.

String operations

String operations such as obtaining a substring or performing a replacement on a string are not part of the standard template functions. However, on a wiki that has Scribunto extension installed, which enables scripting via Lua, one can create a module for string functions, and templates that make these functions accessible for other templates. This was done in the English Wikipedia:

Example use:

  • {{replace|cat on the mat|cat|bat}} --> "bat on the mat"


References can be used to cite sources.

To refer to a source in the middle of the text, follow this example:

<ref name="Ref06">Reference text</ref>

or if a named reference has already been used before in the same page:

<ref name="Ref06"/>

To list all the sources referred to in the text, after a second level heading titled "References":



You can enter mathematical formulas into a wiki, using a math tag, such as:


The formulas are marked up in the TeX markup, the markup of a complex typesetting system specialized on mathematics.

Before you start writing formulas in this markup, you can consider writing the simpler ones in HTML and wiki markup, such as:

f(x) = b + c / d

which is marked up as

 ''f''(x) = ''b'' + ''c'' / ''d''


To get started, follow the examples below.

Examples of mathematical markup
No. Desired Effect Markup
<math>\sum_{k=1}^N k^2</math>
<math>\int\limits_{1}^{3}\frac{e^3/x}{x^2}\, dx</math>
  0      & \cdots & 0      \\
  \vdots & \ddots & \vdots \\ 
  0      & \cdots & 0
  x & y \\
  z & v 

Greek and symbols

There is a way of marking up Greek characters and special symbols, as the following table shows.

Markup of Greek alphabet and some symbols
Desired Effect Markup

α β γ δ ε ζ
η θ ι κ λ μ ν
ξ ο π ρ σ ς
τ υ φ χ ψ ω

&alpha; &beta; &gamma; &delta; &epsilon; &zeta;
&eta; &theta; &iota; &kappa; &lambda; &mu; &nu;
&xi; &omicron; &pi; &rho;  &sigma; &sigmaf;
&tau; &upsilon; &phi; &chi; &psi; &omega;
&Gamma; &Delta; &Theta; &Lambda; &Xi; &Pi;
&Sigma; &Phi; &Psi; &Omega;
∫ ∑ ∏ √ − ± ∞
≈ ∝ = ≡ ≠ ≤ ≥
× · ÷ ∂ ′ ″
∇ ‰ ° ∴ Ø ø
∈ ∉ ∩ ∪ ⊂ ⊃ ⊆ ⊇
¬ ∧ ∨ ∃ ∀
⇒ ⇔ → ↔ ↑
ℵ - – —
&int; &sum; &prod; &radic; &minus; &plusmn; &infin;
&asymp; &prop; {{=}} &equiv; &ne; &le; &ge; 
&times; &middot; &divide; &part; &prime; &Prime;
&nabla; &permil; &deg; &there4; &oslash; &oslash;
&isin; &notin; 
&cap; &cup; &sub; &sup; &sube; &supe;
&not; &and; &or; &exist; &forall; 
&rArr; &hArr; &rarr; &harr; &uarr; 
&alefsym; - &ndash; &mdash; 


Namespace is the part of the name of the page before the first ":". The typical page has no ":" in its name, and is thus said to be in the mainspace.

Some namespaces--native ones--are automatically created by the MediaWiki software while others can be created by the administrators of the particular wiki site. The native namespaces include "Talk:", "User:", "Category:", "Template:", and others; they total 18 namespaces.

When searching the wiki, you can restrict the search to a particular namespace.


This is a glossary of the book.

Contents: Top - 0–9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z




The part of the name of the page before the first ":".


piped link
An internal link or interwiki link where the link target and link label are both specified.


An internal link; a link pointing to another page of the same wiki or knowledge base, marked up using [[target word]], contrasting to links to other web sites.
Text containing wiki markup, such as '''text''' for boldface.