Adding lists in MediaWiki


This is a follow-up article to the ongoing postings regarding adding content in MediaWiki. The plan is to add more short posting about adding content to MediaWiki. This posting talks about lists.

You can create 3 types of lists in MediaWiki:

  • Unordered lists
  • Ordered lists
  • Definition lists

Unordered lists

Unordered lists are just the normal bullet lists probably familiar from word processing software or plain HTML. You create a new list element by using an asterisk (*) at the beginning of each line. It is important that the asterisk is at the beginning of the line for it to work. You can have no whitespace between the line start and the asterisk. The number of asterisk characters indicates the list element level, so for example:

* First element
** First sub-element
*** First sub-sub-element
** Second sub-element
* Second element

Will create an unordered list that gives the following output:

Unordered list example in MediaWiki

Ordered lists

Ordered lists are pretty much more of the same. However, you use the hash character (#) instead of the asterisk. To restart the automatic numbering you must insert a blank line within the list, so

# First element
## First sub-element
### First sub-subelement
## Second sub-element
# Second element

Gives the following output

An example of an ordered list

Combining unordered and ordered lists

It is also possible to combine the two list types to make any kind of crazy combination. Check out the following example:

# element 1
# element 2
#* element 3
#* element 4
#** element 5
#** element 6
## element 7
##* element 8
##** element 9
# element 10

Which gives this result:

Combining unordered and ordered list elements in a crazy partnership

Definition list

A definition list is a list type you expect to find in a dictionary or a glossary. The syntax is a bit different from it’s list siblings:

;First definition : definition text
;Second definition : definition text

So here we have two definition keys with their matching text definition. The output looks like this:

Example of definition list output

The definition text itself can expand over multiple lines and can also contain semicolon (;) characters as part of the text as long as the semicolon is not at the beginning of a new line. Like the other list types it is very important not to type any whitespace between the semicolon and the beginning of the new line. The colon character, however, defining the definition list, can be placed just about anywhere you like.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s