my-server
← Wiki Redirected from Wiki Markup Language

Help:Wikitext

Wikitext, also known as wiki markup or wikicode, is the markup language used by the MediaWiki software to format pages.

To learn how to view and edit wikitext, and how to save changes, see . In most cases, markup can be copied and pasted without the need to write new code. A quick reference guide is available at .

In addition to wikitext, some HTML elements are also permitted for presentation formatting. For more details, see .

Layout

Sections

Article sections in a page will follow that page's or introduction and, if there are four or more, the .

Section headings

The <code>=</code> through <code>======</code> markup are headings for the sections with which they are associated.

  • A single = is styled as the article title and should not be used within an article.
  • Headings are styled through CSS and add an <code>[edit]</code> link. for the relevant CSS.
  • Four or more headings cause a table of contents to be generated automatically.
  • Do not use <em>any</em> markup after the final heading markup – this will either break the heading, or will cause the heading to not be included in an edit summary.

Templates: for use in documentation.

Horizontal rule

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.

The four hyphens must appear at the beginning of a line.

The HTML equivalent is , which can be indented if required. (<code>----</code> always starts at the left margin.)

The template produces a similar rule but allows the thickness to be specified.

Table of contents

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:

  • forces the TOC to appear at the normal location regardless of the number of headings.
  • forces the TOC to appear at the point where the magic word is inserted instead of the normal location.
  • disables the TOC entirely.
  • template can be used to control the depth of subsections included in the TOC. This is useful where the TOC is long and unwieldy.
  • contains a number of specialized TOC templates.

Line breaks

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

  • A line break that is visible in the content is inserted by pressing twice.
  • Pressing once will place a line break in the markup, but it will not show in the rendered content, except when using list markup.
  • Markup such as bold or italics will be terminated at a line break.
  • Blank lines within indented wikitext should not be added, to avoid creating accessibility issues.

HTML equivalent: or can be used to break line layout.

Templates for line breaks:

  • can add multiple line breaks.
  • and adds a break with styling, to clear floating elements. Often used to prevent text from flowing next to unrelated tables or images.

Unbulleted list:

  • and both create an unbulleted list.

Indent text

Indentation is most commonly used on talk pages.

Templates: ,

Blockquote

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.

This uses an HTML tag; template results in the same render.

Center text

Template uses the same markup. To center a table, see . Please do not use tags, as it is obsolete.

Align text to right

You can align content in a separate container:

Or; make the text float around it:

Lists

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.

Unordered lists

Ordered lists

<span class="anchor" id="DL"></span><span class="anchor" id="Definition lists"></span><span class="anchor" id="Association lists"></span><span class="anchor" id="H:DL"></span>Description lists

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 <em>must</em> include one or more definitions. For a single or first value, the <code>:</code> can be placed on the same line after <code>;</code> – but subsequent values must be placed on separate lines.

HTML equivalent: ,

Templates:

Retaining newlines and spaces

The MediaWiki software suppresses single newlines and converts lines starting with a space to preformatted text in a dashed box. HTML suppresses multiple spaces. It is often desirable to retain these elements for poems, lyrics, mottoes, oaths and the like. The extension adds HTML-like tags to maintain newlines and spaces. These tags may be used inside other tags such as ; the template provides a convenient shorthand. may be applied to this tag, e.g.: .

Poems and their translation can be presented side by side, and the language can be indicated with <code>lang="xx"</code>. Following the last side-by-side block, must be used to cancel <code>"float:left;"</code> and to re-establish normal flow. Note that this method does not require a table and its columns to achieve the side-by-side presentation.

Markup

Renders as

Format

Text formatting

Special characters

Special characters can often be displayed using numeric character references or character entity references. See Character encodings in HTML for more information. For example, <code>&amp;Agrave;</code> and <code>&amp;#xC0;</code> both render &Agrave; (A-grave). Percent-encoding can't be used, as it works only in URLs.

Diacritical marks

Diacritic marks, using character entity references.

Punctuation special characters

Using character entity references.

Escaping punctuation characters

The , , and markup tags are also available, for writing <nowiki>"[", "{", "&", "}", "]"</nowiki> for example. These tags prevent these characters from being recognised as wiki markup, which is a possibility in some circumstances.

Commercial symbols

Using character entity references.

Greek characters

Using character entity references.

Egyptian hieroglyphs

WikiHiero is a software extension that renders Egyptian hieroglyphs as PNG images using HTML-like tags.

Example:

Subscripts and superscripts

  • The prefers the and formats, for example <code>x</code>. So this should be used under most circumstances.
  • The latter methods of sub/superscripting cannot be used in the most general context, as they rely on Unicode support that may not be present on all users' machines.

Characters in the Private Use Area, and invisible formatting characters

Invisible and PUA (Private Use Areas) characters should be avoided where possible. When needed, they should both be replaced with their (hexa)decimal code values (as "&#(x)...;"). This renders invisible characters visible, for manual editing, and allows to process pages with PUA characters. The latter should also be tagged with the template for tracking and future maintenance.

Mathematical characters and formulae

Mathematical characters

  • See also , and TeX.

Mathematical formulae

  • Formulae that include mathematical letters, like , and operators like <code>×</code> should not use the plain letter <code>x</code>. See . For a comprehensive set of symbols, and comparison between tags and the template see section .
  • The tag typesets using , which may render as an image or as HTML, depending on environmental settings. The tag is best for the complex formula on its own line in an image format. If you use this tag to put a formula in the line with text, put it in the template.
  • The template , and will size-match a serif font, and will also prevent line-wrap. All templates are sensitive to the <code>=</code> sign, so remember to replace <code>=</code> with <code></code> in template input, or start the input with <code>1=</code>. Use wiki markup and inside the template, as well as other . The template is best for typeset formulas in line with the text.

Spacing in simple math formulae

  • Using <code>&amp;nbsp;</code> to prevent line break is not needed; the template will prevent line breaks anyway; you can use if you need an explicit line break inside a formula.

Complicated formulae

  • See for how to use .
  • A formula displayed on a line by itself should be indented using

Indenting by using the colon (:) character (i.e. using instead of ) is discouraged for .

Links and URLs

Wikilinks<span class="anchor" id="Free links"></span>

Wikilinks are used in wikitext markup to produce internal links between pages. You create wikilinks by putting double square brackets around text designating the title of the page you want to link to. Thus, will be rendered as Texas. Optionally, you can use a vertical bar (|) to customize the link title. For example, typing will produce Lone Star State, a link that is displayed as "<u>Lone Star State</u>" but in fact links to Texas.

Link to another wiki article

  • Internally, the first letter of the target page is automatically capitalized and spaces are represented as underscores (typing an underscore in the link has the same effect as typing a space, but is not recommended).
  • Thus the link hereafter is to the Web address <code>en.wikipedia.org/wiki/Public_transport</code>, which is the Wikipedia article with the name "Public transport". See also .
  • A red link is a page that doesn't exist yet; it can be created by clicking on the link.
  • will appear only as bold text.

Renamed link

  • Same target, different name.
  • The target ("piped") text must be placed first, then the text to be displayed second.

Automatically rename links

  • Simply typing the pipe character | after a link will automatically rename the link in certain circumstances. The next time you open the edit box you will see the expanded piped link. When your edits, you will not see the expanded form until you press Save and Edit again. The same applies to links to sections within the same page.
  • See for details.

Blend link

  • Endings are blended into the link.
  • Exception: a trailing apostrophe (') and any characters following the apostrophe are not blended.
  • Preferred style is to use this instead of a piped link, if possible.
  • Blending can be suppressed by using the tag, which may be desirable in some instances.

Link to a section of a page

  • The part after the hash sign (#) must match a on the page. Matches must be exact in terms of spelling, case, and punctuation. Links to non-existent sections are not broken; they are treated as links to the beginning of the page.
  • Include "| link title" to create a stylish () link title.
  • If sections have the same title, add a number to link to any but the first. #Example section 3 goes to the third section named "Example section". You can use the pipe and retype the section title to display the text without the # symbol.

Create a new page

  • To create a new page:
  • # Edit any page.
  • # Enter a wikilink: <nowiki>[</nowiki>[page name]].
  • # Preview or save.
  • # Activate the link you just made. The new page will open for editing.
  • For more information, see and check out Wikipedia's .
  • Please link to your new article from at least one other article.

Create an alias for a page

  • Create an alias for any page by creating a from one to another.
  • First create a new page whose page name is the name of the alias. That is the redirect.
  • On the first line of the new redirect page, use the syntax shown in the table below. For example, US is a redirect.
  • It is possible to redirect to a section. For example, a redirect to United States#History will redirect to the History section of the United States page.

Link to another

  • The full page name should be included in double square brackets.

Link to the same article in another language (interlanguage links)

  • To link to a corresponding page in another language, use the form: .
  • It is recommended interlanguage links be placed at the very end of the article.
  • Interlanguage links are NOT visible within the formatted article, but instead appear as language links on the sidebar (to the left) under the menu section "languages".
  • NOTE: To create an inline link (a clickable link within the text) to any foreign language article, see and consider the usage notes.

Interwiki link

  • link to any page on other wikis. link to other Wikimedia wikis.
  • Note that interwikimedia links use the internal link style, with double square brackets.
  • See for the list of shortcuts; if the site you want to link to is not on the list, use an external link.
  • See also .

Categories

  • To put an article in a , place a link like into the article. As with interlanguage links, placing these links at is recommended.
  • To link to a category page without putting the article into the category, use a colon prefix (":Category") in the link.

External links

  • Single-square brackets indicate an external link. Note the use of a space (not a pipe |) to separate the URL from the link text in a named link. Square brackets may be used as normal punctuation when not linking to anything – [like this].
  • A URL must begin with a supported URI scheme: <code>https://</code> (preferably) and <code>http://</code> will be supported by all browsers; <code>irc://</code>, <code>ircs://</code>, <code>ftp://</code>, , <code>mailto:</code>, and <code>gopher://</code> will require a plugin or an external application. IPv6 addresses in URLs are currently not supported.
  • A URL containing certain characters will display and link incorrectly unless those characters are percent encoded. For example, a space must be replaced by <code>%20</code>. Encoding can be achieved by:
*Use the link button on the enhanced editing toolbar to encode the link; this tool will add the bracket markup and the linked text, which may not always be desirable.
*Or manually encode the URL by replacing these characters:
*Or use the magic word. See in the MediaWiki documentation for more details.
  • See for style issues, and for indicating the file type of an external link with an icon.

Miscellaneous

Media link

  • To include links to non-image uploads such as sounds, use a "media" link. For images, see next section.
  • Some uploaded sounds are listed at .

Links directly into edit mode

  • These create links that directly go to the edit or view source tab. For example, to create links to the edit tab for this page, either of the following works:

Links partially italicized

  • Linking to a page with a title containing words that are usually italicized, such as the Hindenburg disaster article.

Musical notation

Musical notation is added by using the HTML-like tag. For example:

Images

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

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

For further help on images, including some more versatile abilities, see the and .

Tables

There are two ways to build tables:

  • Using specific wiki markup: (see ).
  • Using HTML elements: , , or .

Columns

Use and templates to produce columns.

References and citing sources

Making a reference citing a printed or online source can be accomplished by using the wiki markup 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.

Templates and transcluding pages

Examples for templates: <nowiki>, , , </nowiki>

are segments of wiki markup that are meant to be copied automatically ("transcluded") into a page. They are specified by putting the template's name in <nowiki></nowiki>. Most templates are pages in the , but it is possible to transclude mainspace pages (articles) by using <nowiki></nowiki>.

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".

  • <nowiki><noinclude></nowiki>: the content will not be rendered there. These tags have no effect here.
  • <nowiki><includeonly></nowiki>: the content will render only there, and will not render here (like invisible ink made visible by means of transclusion).
  • <nowiki><onlyinclude></nowiki>: the content will render here and will render there, but it will only render there what is between these tags.

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 <nowiki><onlyinclude></nowiki> tags. To append text there, wrap the addition in <nowiki><includeonly></nowiki> tags before, within, or after the section. To omit portions of the section, nest <nowiki><noinclude></nowiki> tags within it.

If a page is transcluded without transclusion markup, it may cause an unintentional . Any page transcluding it will contain the same category as the original page. Wrap the category markup with <nowiki><noinclude></nowiki> tags to prevent incorrect categorization.

Some templates take parameters, as well, which you separate with the pipe character <code>|</code>.

Talk and project pages

These are likely to be helpful on and .

Signing comments

  • The tilde character (~) is used when signing a comment on a talk page. Your username provides a link to your .

Linking to old revisions of pages, diffs, and specific history pages

  • The external link function is mainly used for these. Open an old revision or diff, and copy the URL from the address bar, pasting it where you want it.
  • You can also use an . Unlike the template , this kind of link can even be used in edit summaries.
  • If the diff intended to be shown is between an immediately previous revision, the first parameter can be dropped.
  • For an old revision, you can also use a . Though here only the main text is guaranteed to be retained (images and templates will be shown as they are today, not as they were at the time).

What links here, and recent changes linked

  • The following markup can be used. For example, for the article Beetroot:

User edits

  • Link to a user's .

Coloring and highlighting text

  • Using the and templates:

Example text

The family of templates can be used to highlight example text. These templates do not work in mainspace—that is, in regular articles—they are intended for use on project pages (such as ), help pages, and user pages.

Show deleted or inserted text

  • When editing regular Wikipedia articles, just make your changes, and do not mark them up in any special way, except when the article itself discusses deleted or inserted content, such as an amendment to a statute:
  • to indicate deleted content, use
  • to indicate inserted content, use
  • This also applies to changing one's own talk page comments.

<span class="anchor" id="Strikethrough"></span> Strikethrough

The template marks up an inline span of text with the tag. This is usually rendered visually by drawing a horizontal line through it. Outside of articles, it can be used to mark something as no longer accurate or relevant without removing it from view. Do not use it, however, to indicate document edits. For that, use the tag instead. See for details.

The template and tag are for inline content only; to strike out a block of text, such as a multi-line talk page post, use either or to render the entire block with strikethrough markup.

<span class="anchor" id="Limiting formatting"></span><span class="anchor" id="Limiting formatting / escaping wiki markup"></span> Limiting formatting and escaping wikitext

Several formatting methods in wikitext can force the wikitext to be displayed exactly as typed – essentially a "what you see is what you get" effect. These techniques are useful when you need to prevent wikitext from being interpreted by parser, such as when showing examples of wikitext nested in a template.

<span class="anchor" id="NOWIKI"></span>Nowiki

There are two types of nowiki markup, which operate in different ways:

  • The tag pair encloses a section of wiki markup, which is then displayed as normal text.
  • The empty tag interrupts the wiki markup and causes it to display as normal text.

Both forms neutralize the rendering of wiki markup, as shown in the examples below. For example, the characters that have wiki markup meaning at the beginning of a line (, , , and ) can be rendered in normal text. Editors can normalize the font of characters trailing a wikilink, which would otherwise appear in the wikilink font. And newlines added to wikitext for readability can be ignored.

Note to template editors: tag works only on its source page, not the target.

The rest of the section consists of simple, live examples showing how a single nowiki tag escapes entire linkage structures, beyond and :

[[ fullpagename |