= 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:'''

<pre>=== Level 3 ===</pre>

'''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:'''

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

'''Result:'''

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

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

=== Using leading spaces ===

'''Markup:'''

<pre> Start each line with a space.</pre>
<pre> Text is '''preformatted''' and</pre>
<pre> ''markups'' '''''can''''' be done.</pre>

'''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:'''

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

'''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:'''

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

'''Result:'''

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

== Edit Markup ==

'''Markup:'''

<pre>Use 3 apostrophes to '''bold''' and 2 to ''italicize'' or 5 to '''''bold and italicize the text'''''.</pre>

'''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:'''

<pre>* start a line with an asterisk</pre>

'''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:'''

<pre># ordered lists begin with a # character</pre>

'''Result:'''

# ordered lists begin with a # character
# and follow
# the same rules
## for
## multiple
## levels

== Links ==

'''Markup:'''

<pre>Internal links are created by enclosing the name in double square bracket characters: [[Home]] or [[Home#Test Comment]].</pre>
<pre>To create an internal link with alternate text, use the vertical bar character as a separator: [[Home | go home]].</pre>
<pre>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].</pre>

'''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: [[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].

'''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 http://www.mediawiki.org/wiki/Help:Tables].

=== Table Examples ===

Some markup within table cells works.
{|
!'''Markup'''
!'''Result'''
|-
|<pre>&copy;</pre>
|&copy;
|-
|<pre>&trade;</pre>
|&trade;
|-
|<pre>&euro;</pre>
|&euro;
|}

Simple table, no formatting or TH cells.

{|
|Orange
|Apple
|-
|Bread
|Pie
|-
|Butter
|Ice cream
|}

Same as above, but multiple cells on single line of source.
{|
|Orange||Apple||more
|-
|Bread||Pie||more
|-
|Butter||Ice<br/>cream||and<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.

{|
! style="text-align:left;"| Item
! Amount
! Cost
|-
|Orange
|10
|7.00
|-
|Bread
|4
|3.00
|-
|Butter
|1
|5.00
|-
!Total
|
|15.00
|}

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

{|
|+Food complements
|-
|Orange
|Apple
|-
|Bread
|Pie
|-
|Butter
|Ice cream
|}

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

{| class="wikitable"
|+Food complements
|-
|Orange
|Apple
|-
|Bread
|Pie
|-
|Butter
|Ice cream
|}

HTML colspan and rowspan attributes on cells for advanced layout.

{| class="wikitable"
!colspan="6"|Shopping List
|-
|rowspan="2"|Bread & Butter
|Pie
|Buns
|Danish
|colspan="2"|Croissant
|-
|Cheese
|colspan="2"|Ice cream
|Butter
|Yogurt
|}

XHTML attributes may be added to tables.

{| class="wikitable" style="text-align: center; color: green;"
|Orange
|Apple
|12,333.00
|-
|Bread
|Pie
|500.00
|-
|Butter
|Ice cream
|1.00
|}

XHTML attributes may be added to individual cells.

{| class="wikitable"
| Orange
| Apple
| style="text-align:right;" | 12,333.00
|-
| Bread
| Pie
| style="text-align:right;" | 500.00
|-
| Butter
| Ice cream
| style="text-align:right;" | 1.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 |.

{| class="wikitable"
| Orange || Apple     || style="text-align:right;" | 12,333.00
|-
| Bread  || Pie       || style="text-align:right;" | 500.00
|-
| Butter || Ice cream || style="text-align:right;" | 1.00
|}

Attributes may be placed on individual rows.

{| class="wikitable"
| Orange
| Apple
| style="text-align:right;"| 12,333.00
|-
| Bread
| Pie
| style="text-align:right;"| 500.00
|- style="font-style: italic; color: green;"
| Butter
| Ice cream
| style="text-align:right;"| 1.00
|}

An example of a red 3 pixel dashed border.

{| style="border-collapse: separate; border-spacing: 0; border: 3px dashed #F00; padding: 0"
|-
| style="border-style: solid; border-width: 0 1px 1px 0"|
Orange
| style="border-style: solid; border-width: 0 0 1px 0"|
Apple
|-
| style="border-style: solid; border-width: 0 1px 0 0"|
Bread
| style="border-style: solid; border-width: 0"|
Pie
|}

Same as above, but with borders collapsed.

{| style="border-collapse: collapse; border: 3px dashed #F00"
|-
| style="border-style: solid; border-width: 1px"|
Orange
| style="border-style: solid; border-width: 1px"|
Apple
|-
| style="border-style: solid; border-width: 1px"|
Bread
| style="border-style: solid; border-width: 1px"|
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.

{|style="border-style: solid; border-width: 20px"
|
Hello
|}

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

{|style="border-style: solid; border-width: 10px 20px 100px 0"
|
Hello
|}

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

{| class="wikitable" style="color:green; background-color:#ffffcc;" cellpadding="10"
|Orange
|Apple
|-
|Bread
|Pie
|-
|Butter
|Ice 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.

{| class="wikitable"
|+ style="caption-side:bottom; color:#e76700;"|''Food complements''
|-
|Orange
|Apple
|-
|Bread
|Pie
|-
|Butter
|Ice cream
|}

Column widths can be specified.

{| style="color: black; background-color: #ffffcc;" width="85%"
| colspan="2" | This column width is 85% of the screen width (and has a background color)
|-
| style="width: 30%; background-color: white;"|
'''This column is 30% counted from 85% of the screen width'''
| style="width: 70%; background-color: orange;"|
'''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.

{| class="wikitable" style="margin-left: auto; margin-right: 0px;"
| Orange
| Apple
|-
| Bread
| Pie
|-
| Butter
| Ice cream
|}

A table aligned to center.

{| class="wikitable" style="margin: auto;"
| 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.

{| class="wikitable"
|- style="vertical-align:top;"
| style="height:100px; width:100px; text-align:left;" | A
| style="height:100px; width:100px; text-align:center;" | B
| style="height:100px; width:100px; text-align:right;" | C
|- style="vertical-align:middle;"
| style="height:100px; width:100px; text-align:left;" | D
| style="height:100px; width:100px; text-align:center;" | E
| style="height:100px; width:100px; text-align:right;" | F
|- style="vertical-align:bottom;"
| style="height:100px; width:100px; text-align:left;" | G
| style="height:100px; width:100px; text-align:center;" | H
| style="height:100px; width:100px; text-align:right;" | I
|}

Floating text around a table.

{| class="wikitable" style="float:right; margin-left: 10px;"
| 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:'''

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

'''Result:'''

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.


== Blockquote ==

'''Markup:'''

<pre>Text before</pre>
<pre><blockquote>Blockquote</blockquote></pre>
<pre>Text after</pre>


'''Result:'''

Text before
<blockquote>Blockquote</blockquote>
Text after

== Comment ==

'''Markup:'''

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

'''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 http://en.wikipedia.org/wiki/List_of_HTML_entities].

'''Markup:'''

<pre>&copy; 2013 Joe Doe, delta: &delta;, euro: &euro;</pre>

'''Result:'''

&copy; 2013 Joe Doe, delta: &delta;, euro: &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 http://www.mediawiki.org/wiki/Help:Images].

=== Images ===

'''Markup:'''

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

'''Result:'''

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

=== Video ===

'''Markup:'''

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

'''Result:'''

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

=== Audio ===

'''Markup:'''

<pre>[[File:help-common/audio.mp3]]</pre>

'''Result:'''

[[File: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.

<pre><code>
Result: 17 errors / 14 warnings

Info: W3c Online Validation

line 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></pre>
