Media Wiki Syntax

Features currently not working with moin’s mediawiki parser are marked with MWTODO.

This page introduces you to the most important elements of the Media Wiki syntax.

Table Of Contents

MWTODO: Table of contents does not work. A table of contents should be generated by default when a page has more than 3 section headings. A TOC may be positioned by adding the magic word

__TOC__

at the desired location. If a TOC is desired even if there is less than 3 section headings, then the magic word

__FORCETOC__

will display the TOC at the default position.

Headings

Markup:

=== Level 3 ===

Result:

Level 3

Level 4

Level 5
Level 6

Preformatted Text

Using tags

Preformatted text is displayed using the nowiki, pre, code, or tt tags.

Markup:

<nowiki>preformatted    '''text''' using nowiki    indented line 2</nowiki><code>preformatted    '''text''' using code    indented line 2</code>

Result:

preformatted '''text''' using nowiki indented line 2

preformatted '''text''' using code indented line 2

MWTODO: There is a bug causing whitespace compression within preformatted text.

Using leading spaces

Markup:

 Start each line with a space.

 Text is '''preformatted''' and
 ''markups'' '''''can''''' be done.

Result:

Start each line with a space.

Text is preformatted and markups can be done.

MWTODO: There should be 3 consecutive lines above. The first line is separated and the second and third lines are combined.

Customized

Markup:

<pre style="color: red">Text is '''preformatted''' with a style and ''markups'' '''''cannot''''' be done</pre>

Result:

<pre style="color: red">Text is preformatted with a style and markups cannot be done</pre>

MWTODO: The use of customized styles within a pre tag does not work.

Preformatted text with text wrap

Markup:

<code>This long sentence is used to demonstrate text wrapping. This additional sentence makes the text even longer.</code>

Result:

This long sentence is used to demonstrate text wrapping. This additional sentence makes the text even longer.

Edit Markup

Markup:

Use 3 apostrophes to '''bold''' and 2 to ''italicize'' or 5 to '''''bold and italicize the text'''''.

Result:

Use 3 apostrophes to bold and 2 to italicize or 5 to bold and italicize the text.

Lists

Mediawiki has markup for ordered lists and unordered lists. Ordered lists use only numbers, there is no markup for use of alphabetic letters or roman numerals.

Unordered lists

Markup:

* start a line with an asterisk

Result:

  • start a line with an asterisk

    • use 2 starting asterisks to indicate a deeper level

      • or 3 to indicate an even deeper level

  • a blank line after an entry ends the list

  • you can start a new list after...

  • a blank line

Ordered lists

Markup:

# ordered lists begin with a # character

Result:

  1. ordered lists begin with a # character

  2. and follow

  3. the same rules

    1. for

    2. multiple

    3. levels

Markup:

Internal links are created by enclosing the name in double square bracket characters: [[Home]] or [[Home#Test Comment]].

To create an internal link with alternate text, use the vertical bar character as a separator: [[Home | go home]].
For external links, use a bare link like http://moinmo.in or wrap the link in single [] characters to show alternate text as the link: [http://moinmo.in Python Wiki].

Result:

Internal links are created by enclosing the name in double square bracket characters: Home or Home#Test Comment.

To create an internal link with alternate text, use the vertical bar character as a separator: go home.

For external links, use a bare link like http://moinmo.in or wrap the link in single [] characters to show alternate text as the link: Python Wiki.

MWTODO: Links to internal page anchors do not work if there is an embedded space character. The bare link version of external links do not work. Wrapping an external link in single [] characters without alternate text uses the text following the ending ] as the alternate text.

Tables

The MediaWiki syntax for tables currently offers no support for specifying common HTML5 attributes for <thead>...</thead>, <tbody>...</tbody> and <tfoot>...</tfoot>). Those standard HTML elements are not accepted even in their HTML or XHTML syntax.

Note that given the absence of a specified tbody within a table, some browsers will automatically generate a tbody enclosing all rows.

Without a way to show a large block of preformatted text, and many parts of tables broken as well, it is difficult to show table markup. The following examples are largely copied from http://www.mediawiki.org/wiki/Help:Tables.

Table Examples

Some markup within table cells works.

MarkupResult
&copy;
©
&trade;
&euro;

Simple table, no formatting or TH cells.

OrangeApple
BreadPie
ButterIce cream

Same as above, but multiple cells on single line of source.

OrangeApplemore
BreadPiemore
ButterIce<br/>creamand<br/>more

Extra spaces in table cells have no effect on rendering.

Orange Apple more
Bread Pie more
Butter Ice cream and more

Long texts and wiki markup is permitted within cells.

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. * Lorem ipsum dolor sit amet * consetetur sadipscing elitr * sed diam nonumy eirmod tempor invidunt

Table heading cells are indicated by using the ! character instead of a | character. TH tags are not created, instead, the contents of a TD tag are wrapped in STRONG tags.

Item Amount Cost
Orange107.00
Bread43.00
Butter15.00
Total15.00

MWTODO: Table captions are created by using a + character. This does not work in moin.

OrangeApple
BreadPie
ButterIce cream

Basic styling (light gray background, borders, padding and align left) can be achieved by adding class="wikitable".

OrangeApple
BreadPie
ButterIce cream

HTML colspan and rowspan attributes on cells for advanced layout.

Shopping List
Bread & ButterPieBunsDanishCroissant
CheeseIce creamButterYogurt

XHTML attributes may be added to tables.

OrangeApple12,333.00
BreadPie500.00
ButterIce cream1.00

XHTML attributes may be added to individual cells.

Orange Apple12,333.00
Bread Pie500.00
Butter Ice cream1.00

Cell attributes may be used when coding multiple cells on a single line. The cells are separated by ||, and within each cell the attribute(s) and value are separated by |.

Orange Apple 12,333.00
Bread Pie 500.00
Butter Ice cream 1.00

Attributes may be placed on individual rows.

Orange Apple12,333.00
Bread Pie500.00
Butter Ice cream1.00

An example of a red 3 pixel dashed border.

Orange Apple
Bread Pie

Same as above, but with borders collapsed.

Orange Apple
Bread Pie

MWTODO: An attempt to create a one cell table with a border 20 pixels wide. This fails, the contents of the table cell precede the table and the table is empty causing HTML validation errors.

Hello

MWTODO: Same as above, but with different widths for each border.

Hello

CSS style attributes can be added with or without other HTML attributes.

OrangeApple
BreadPie
ButterIce cream

Attributes can be added to the caption and headers. Because simple captions fail, so does this attempt to put the caption on the bottom and colorize the text.

OrangeApple
BreadPie
ButterIce cream

Column widths can be specified.

This column width is 85% of the screen width (and has a background color)
This column is 30% counted from 85% of the screen width This column is 70% counted from 85% of the screen width (and has a background color)

Table alignment is achieved by using CSS styles. Here the right margin is set to 0.

Orange Apple
Bread Pie
Butter Ice cream

A table aligned to center.

Orange Apple
Bread Pie
Butter Ice cream

The alignment of cell contents can be controlled with 2 different CSS properties: text-align and vertical-align. text-align can be specified at the table, row or individual cells, while vertical-align only can be specified at individual rows or cells.

ABC
DEF
GHI

Floating text around a table.

Orange Apple
Bread Pie
Butter Ice cream

Lorem ipsum dolor sit amet, consectetuer adipiscing

elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi

enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea

commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat,

vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit

praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.

HTML tags

Markup:

Split a sentence<br />with a br tag.
Show <ins>inserted</ins> text or <u>underlined</u> text or <s>struck out</s> text or <del>deleted</del> text.

Result:

Split a sentence
with a br tag.

Show inserted text or underlined text or struck out text or deleted text.

Blockquote

Markup:

Text before
<blockquote>Blockquote</blockquote>

Text after

Result:

Text before

Blockquote
Text after

Comment

Markup:

<!-- This is a comment --> Comments are visible only in the edit zone.

Result:

<!-- This is a comment -->Comments are visible only in the edit zone.

MWTODO: Comments are not hidden

Symbols

Mediawiki supports all the symbols defined in http://en.wikipedia.org/wiki/List_of_HTML_entities.

Markup:

&copy; 2013 Joe Doe, delta: &delta;, euro: &euro;

Result:

© 2013 Joe Doe, delta: δ, euro: €

Media

MWTODO: While media is displayed, all types are displayed with object tags that generate HTML validation errors due to namespace issues. A second issue is that the options for captions, sizing and positioning is not supported. See http://www.mediawiki.org/wiki/Help:Images.

Images

Markup:

text [[File:help-common/cat.jpg|50px]] text [[File:help-common/logo.png|center]] text [[File:help-common/logo.svg|top]]text

Result:

text +get/help-common/cat.jpg text +get/help-common/logo.png text +get/help-common/logo.svgtext

Video

Markup:

[[File:help-common/video.mp4|MY VIDEO]]

Result:

+get/help-common/video.mp4

Audio

Markup:

[[File:help-common/audio.mp3]]

Result:

+get/help-common/audio.mp3

HTML Validation

MWTODO: This page generated numerous HTML validation errors. The detail below has lost line formatting because of other bugs.

<code>Result: 17 errors / 14 warningsInfo: W3c Online Validationline 509 column 103 - Error: Attribute xmlns:ns1 not allowed here.line 509 column 103 - Warning: Attribute with the local name xmlns:ns1 is not serializable as XML 1.0.line 509 column 1354 - Error: No p element in scope but a p end tag seen.line 509 column 2406 - Error: No p element in scope but a p end tag seen.line 509 column 3133 - Error: No p element in scope but a p end tag seen.line 510 column 68 - Error: No p element in scope but a p end tag seen.line 512 column 173 - Error: No p element in scope but a p end tag seen.line 513 column 468 - Error: No p element in scope but a p end tag seen.line 513 column 1238 - Error: No p element in scope but a p end tag seen.line 513 column 2068 - Error: No p element in scope but a p end tag seen.line 513 column 2777 - Error: No p element in scope but a p end tag seen.line 514 column 199 - Error: No p element in scope but a p end tag seen.line 525 column 873 - Warning: A table row was 2 columns wide, which is less than the column count established by the first row (3).line 525 column 1058 - Error: Row 1 of a row group established by a tbody element has no cells beginning on it.line 525 column 1150 - Warning: A table row was 2 columns wide and exceeded the column count established by the first row (0).line 525 column 1239 - Warning: A table row was 2 columns wide and exceeded the column count established by the first row (0).line 525 column 1336 - Warning: A table row was 2 columns wide and exceeded the column count established by the first row (0).line 525 column 1551 - Error: Row 1 of a row group established by a tbody element has no cells beginning on it.line 525 column 1643 - Warning: A table row was 2 columns wide and exceeded the column count established by the first row (0).line 525 column 1732 - Warning: A table row was 2 columns wide and exceeded the column count established by the first row (0).line 525 column 1829 - Warning: A table row was 2 columns wide and exceeded the column count established by the first row (0).line 525 column 4968 - Error: Row 1 of a row group established by a tbody element has no cells beginning on it.line 527 column 15 - Warning: A table row was 2 columns wide and exceeded the column count established by the first row (0).line 529 column 13 - Warning: A table row was 2 columns wide and exceeded the column count established by the first row (0).line 529 column 196 - Error: Row 1 of a row group established by a tbody element has no cells beginning on it.line 531 column 15 - Warning: A table row was 2 columns wide and exceeded the column count established by the first row (0).line 533 column 13 - Warning: A table row was 2 columns wide and exceeded the column count established by the first row (0).line 534 column 10 - Error: Misplaced non-space characters insided a table.line 534 column 10 - Error: Cannot recover after last error. Any further errors will be ignored.</code>