Инструменты пользователя

Инструменты сайта


wiki:faq-lists

Working with Lists

Multiline List Items

:?: How can I add a code block or multiple lines in a list item?

:!: The list syntax expects you to put each item in a single line and you may not interrupt numbered lists or the index will restart at 1. This makes it impossible to add tables into a list item for example. However you can add code/file block or line breaks in a list item. For code blocks make sure they start on the same line as your item, for linebreaks use the forced line break syntax \\.

Here's an example:

  - first item 
  - second item with linebreak\\ second line
  - third item with code: <code>
some code
comes here
</code>
  - fourth item

Which renders like this:

  1. first item
  2. second item with linebreak
    second line
  3. third item with code:
    some code
    comes here
  4. fourth item

You can use the same trick to include other syntax like tables into a list by using the wrap plugin to wrap your table.

Continue List Numbering

:?: Is it possible to have two ordered lists, with the second picking up numbering at where the first stopped?

:!: No, that's currently not possible with the default list syntax. As soon as one list finishes, the numbering restarts:

  - first item
  - second item

No longer a list

  - third item? no, it's the first item of the second list
  1. first item
  2. second item

No longer a list

  1. third item? no, it's the first item of the second list

Styling the List Numbering

:?: I don't like the default list numbering of ordered lists. How can I change it?

:!: The number format is defined through CSS. The default template defines formatting for the first 4 list levels like this:

div.dokuwiki ol { list-style-type: decimal; }
div.dokuwiki ol ol { list-style-type: upper-roman; }
div.dokuwiki ol ol ol { list-style-type: lower-alpha; }
div.dokuwiki ol ol ol ol { list-style-type: lower-greek; }

You can easily override this in your userstyle.css.

List Plugins

There are several plugins that implement alternative syntax for lists and might make things possible that can't be achieved by the default syntax. See Plugins tagged with "list".

wiki/faq-lists.txt · Последнее изменение: 2011/12/02 17:55 (внешнее изменение)