MediaWiki table syntax

From Sharkysoft Wiki
Jump to: navigation, search

MediaWiki supports two syntaxes for entering tables. Equivalent source using both syntaxes is shown for the table below:

digit word
1 one
2 two
3 three

MediaWiki syntax

Here is how the table is coded in MediaWiki syntax:

{|align=center border=1 cellspacing=0 cellpadding=4
|-
!digit
!word
|-
|1
|one
|-
|2
|two
|-
|3
|three
|}

As you can see, this syntax is straight-forward and fairly easy for non-programmers to pick up on, but it is also perhaps a little inflexible. If you want greater flexibility, consider using the HTML syntax instead.

HTML syntax

Here is how the table above would be coded in HTML:

<table align=center border=1 cellspacing=0 cellpadding=4>
 <tr>
  <th>digit</th>
  <th>word</th>
 </tr>
 <tr>
  <td>1</td>
  <td>one</td>
 </tr>
 <tr>
  <td>2</td>
  <td>two</td>
 </tr>
 <tr>
  <td>3</td>
  <td>three</td>
 </tr>
</table>


MediaWiki doesn't support all HTML attributes, but it supports enough for experienced HTML coders to specify their table without too many surprises. As you can see, the standard HTML table tags are supported. Various attributes for each tag are also supported. Experiment to see what works.

If you plan to play around with tables a lot in MediaWiki, you should take a serious look at FCKEditor, a rich editor for MediaWiki. It's easy to install and makes working with MediaWiki tables a breeze.

Personal tools
Namespaces

Variants
Actions
Navigation
Tools