Help:List

From Absit Omen Lexicon

List basics

There are three types of lists: ordered lists, unordered lists, and definition lists. In the following sections, various list types are used for different examples, but other list types will generally give corresponding results.

Wikitext Rendering
* Lists are easy to do:
** start every line
* with a star
** more stars mean
*** deeper levels
  • Lists are easy to do:
    • start every line
  • with a star
    • more stars mean
      • deeper levels
*A newline
*in a list  
marks the end of the list. Of course
*you can
*start again.
  • A newline
  • in a list

marks the end of the list. Of course

  • you can
  • start again.
# Numbered lists are good
## very organized
## easy to follow
  1. Numbered lists are good
    1. very organized
    2. easy to follow
Definition lists:
; Term : Definition
or
; Term
: Definition
Can be used for more than terms and definitions.

Definition lists:

Term
Definition

or

Term
Definition

Can be used for more than terms and definitions.

* Or create mixed lists
*# and nest them
*#* like this.
*#*; Fruits
*#*: Apple
*#*: Blueberry
  • Or create mixed lists
    1. and nest them
      • like this.
        Fruits
        Apple
        Blueberry
# A line break in an item is done with HTML<br />like this.
# Just breaking the line will accidentally end the list
like this.
# This was supposed to be item 3, not a new list.
  1. A line break in an item is done with HTML
    like this.
  2. Just breaking the line will accidentally end the list

like this.

  1. This was supposed to be item 3, not a new list.
* A new paragraph in an item is also HTML.<p>Like so.</p>
* Same goes for<blockquote>"block quotations"</blockquote>like that.
* Note that these are done without line-breaking the wikicode.
  • A new paragraph in an item is also HTML.

    Like so.

  • Same for

    "block quotations"

    like that.
  • Note that these are done without line-breaking the wikicode.

Paragraphs and other breaks

All of the techniques described in this section can be used with each other and with any type of list, at any list level.

Paragraphs inside list items

For simplicity, list items in pure wiki markup cannot be more complex than a basic paragraph. A line break in the wikicode of a list item will end not just the item but the entire list, and reset the counter on ordered lists. Separating unordered list items with blank lines may look approximately normal on-screen, but it creates many separate one-item lists, which is a problem for people using wikipedia:screen readers and is prohibited by the policy on accessibility for people with disabilities, and is also problematic for machine analysis of the article, and for reuse of Wikipedia content more generally.

Paragraphs can be created inside list items by using the HTML <p> (paragraph) element around the second and subsequent paragraphs, with no line breaks in the wiki code:

#Paragraph 1.<p>Paragraph 2.</p><p>Paragraph 3.</p>
#Second item.

gives

  1. Paragraph 1.

    Paragraph 2.

    Paragraph 3.

  2. Second item

Do not use <br /><br /> as a substitute for <p>; 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:

#Paragraph 1.<!--
 --><p>Paragraph 2.</p><!--
 --><p>Paragraph 3.</p>
#Second item.
  1. Paragraph 1.

    Paragraph 2.

    Paragraph 3.

  2. Second item.

This technique can be used with the other examples below.

Line breaks inside list items

Use a single <br /> for a non-paragraph line break, e.g. where using a nested list is not desired because sub-items are already preceded by numbers:

Recipe:

#Gather ingredients:<br />1{{frac|1|2}} tsp eye of newt (powdered)<br />2 bat wings<br />4 cups mandrake root juice
#Stir in cauldron over low flame for 30 minutes

gives

  1. Gather ingredients:
    1.5  tsp eye of newt (powdered)
    2 bat wings
    4 cups mandrake root juice
  2. Stir in cauldron over low flame for 30 minutes

Nested blocks inside list items

Similar HTML usage can provide for block quotations within list items:

*Beginning of first item.<blockquote>A large quotation.</blockquote>Rest of first item.<br /><br />
*Second item.

or

*Beginning of first item.<!--
 --><blockquote>A large quotation.</blockquote><!--
 -->Rest of first item.<br /><br />
*Second item.

gives

  • Beginning of first item.

    A large quotation.

    Rest of first item.

  • Second item.


Spacing between items

For an unordered list with items that are more than one paragraph long, using the HTML comment trick mentioned above to add a blank line between items in the wikicode may be necessary to avoid editor confusion. This is done with a commented-out line:

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

  1. First item
  2. Second item

The comment must begin on the same line on which the preceding item ends, and the comment must end on its own line. Wrong:

#First item
<!--
                                                -->
#Second item

Wrong:

#First item
<!--
                                                
-->#Second item

If the rendered text 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<br /><br />
#Item 2<br /><br />

gives

  1. Item 1

  2. Item 2

Compare the version without the spacing:

  1. Item 1
  2. Item 2

Changing the list type

The list type (which type of marker appears before the list item) can be changed in CSS by setting the list-style-type property:

wikitext rendering
<ol style="list-style-type: lower-roman;">
  <li>About the author</li>
  <li>Foreword to the first edition</li>
  <li>Foreword to the second edition</li>
</ol>
  1. About the author
  2. Foreword to the first edition
  3. Foreword to the second edition

Comparison with a table

Apart from providing automatic numbering, the numbered list also aligns the contents of the items, comparable with using table syntax:

{|
|-
| align=right |  9.||Amsterdam
|-
| align=right | 10.||Rotterdam
|-
| align=right | 11.||The Hague
|}

gives

9. Amsterdam
10. Rotterdam
11. 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.

Multi-column bulleted list

{| 
| 
*1
*2 
| 
*3
*4
|}

gives:

  • 1
  • 2
  • 3
  • 4


Tables

A one-column table is very similar to a list, but it allows sorting. If the wikitext itself is already sorted with the same sortkey, this advantage does not apply. A multiple-column table allows sorting on any column.

See also Help:Tables.