Paragraphs can be created inside list items by using the HTML (paragraph) element around the second and subsequent paragraphs, :
Do not use as a substitute for ; they have different semantic meanings and are not interchangeable.
For code readability (the improvement is more apparent when the paragraphs are long, rather than with short examples like these), line-breaks may be created with HTML comments, <!-- ... -->, that begin on one line against the end of that line's code and end on another line, against the beginning of that line's code:
This technique can be used with the other examples below.
Another case like this is small nested code blocks:
Here, linebreaks still cannot occur inside the list item, even if they are inside , and the HTML comment trick does not work with , which is why this technique is only suitable for code examples.
In wikimarkup, unfortunately, sublists follow the same rules as sections of a page: the only possible part of the list item not in sublists is before the first sublist.
In the case of an unnumbered first-level list in wikimarkup, this limitation can be somewhat worked around by splitting the list into multiple lists; indented text between the partial lists may visually serve as part of a list item after a sublist. However, many readers find this confusing, as the indentation makes it look more like a continuation of the last sublist item. Also, this technique may give, depending on CSS, a blank line before and after each list, in which case, for uniformity, every first-level list item could be made a separate list, with further complicates the code. For complex lists like this, it is recommended to use the HTML technique, and to replace instances of the "quick and dirty" wikimarkup version with the HTML version.
Numbered lists illustrate that what should look like one list may, for the software, consist of multiple, nested lists. Unnumbered lists give a corresponding result, except that the problem of restarting with 1 is not applicable.
One level deeper, with a sublist item continuing after a sub-sublist, one gets even more blank lines; however, the continuation of the first-level list is not affected:
See also and subdivisions.
# First item<!--
-->
# Second item
This doesn't produce unwanted visible spacing or bad list code in the rendered page like adding a plain blank line would:
# First item
<!--
-->
# Second item
Wrong:
# First item
<!--
-->#Second item
If the has a readability problem due to complex list items, or for some other reason space is desired between list items, simply add a pair of explicit HTML line-breaks to the end of the list items:
# Item 1* Lists are easy to do:
** start every line
* with a star
** more stars mean
*** deeper levels
# Item 2* A newline
* in a list
marks the end of the list. Of course
* you can
* start again.
gives
Compare the version without the spacing:
When using explicit HTML list items, use an explicit CSS margin spacing of 4em to double the default 2em spacing. Though not the simplest, this is the cleanest and most versatile method, as it does not rely on any peculiarities of the parser, nor on abusing any semantic markup for purely visual purposes. It allows starting with a number other than 1 (see below). It is the recommended method for complex lists.
The parser translates an ordered list, , without any list items, (in this case, it contains just another ) into a with a style="margin-left: 2em;", causing indentation of the contents. This is a common, versatile but potentially confusing method, as it allows starting with a number other than 1 (see below). It is , unnecessarily complex and may be confusing to other editors, because it looks like invalid HTML. The parser corrects it on-the-fly, but only MediaWiki experts know this, with the result that other editors may try to "correct" it by removing what looks like redundant code.
Just put an explicit HTML around wiki-markup list items. It functions the same as the previous example with the content of the "ordered list without any list items", which itself is an ordered list, expressed with # codes; the HTML produced, and hence the rendering, is the same. This is the simplest method, and recommended when starting a simple list with number 1.
A list of one or more lines starting with a colon creates a definition list without definition terms, and with the items as definition descriptions, hence indented. However, if the colons are in front of the codes "*" or "#" of an unordered or ordered list, the list is treated as one definition description, so the whole list is indented. : This technique produces poorly formed (though technically DTD-validating) markup and abuses the semantic HTML purpose of definition lists for a purely visual effect, and is thus a usability and accessibility problem. It will work in a hurry, but should be replaced with cleaner code, using one of the techniques described above.
The page demonstrates that several of these methods show all digits of 3-digit numbers.
Or:
Only the list item whose value is being set needs to be written in HTML, the rest of the list may use wiki syntax:
This does not work inside .
| Amsterdam |
| Rotterdam |
| The Hague |
| Amsterdam |
| Rotterdam |
| The Hague |
This non-automatic numbering has the advantage that if a text refers to the numbers, insertion or deletion of an item does not disturb the correspondence.
|
|
|
|
In combination with the extra indentation explained in the previous section:
|
|
gives
|
|
Using the computation of the starting values can be automated, and only the first starting value and the number of items in each column except the last has to be specified. Adding an item to, or removing an item from a column requires adjusting only one number, the number of items in that column, instead of changing the starting numbers for all subsequent columns.
gives
gives
gives
gives
Note that the starting values of each column (125, 3, 2) have no effect when the disc list type is used.
# Numbered lists are good
## very organized
## easy to follow example 1, example 2, example 3
Title of list: example 1, example 2, example 3
This style requires less space on the page, and is preferred if there are only a few entries in the list, it can be read easily, and a direct edit point is not required. The list items should start with a lowercase letter unless they are proper nouns.
See also Table.
ol { margin-left: 5.2em;}
ul { list-style: decimal; }
unordered lists are changed to ordered ones. This applies (as far as the CSS selector does not restrict this) to all ul-lists in the HTML source code:
Since each special page, like other pages, has a class based on the pagename, one can separately specify for each type whether the lists should be ordered, see User contributions#User styles and What links here#User styles.
However, it does not seem possible to make all page history lists ordered (unless one makes all lists ordered), because the class name is based on the page for which the history is viewed.