Table of Contents
Tables
DokuWiki supports a simple syntax to create tables.
Heading 1 | Heading 2 | Heading 3 |
---|---|---|
Row 1 Col 1 | Row 1 Col 2 | Row 1 Col 3 |
Row 2 Col 1 | some colspan (note the double pipe) | |
Row 3 Col 1 | Row 3 Col 2 | Row 3 Col 3 |
Table rows have to start and end with a |
for normal rows or a ^
for headers.
^ Heading 1 ^ Heading 2 ^ Heading 3 ^ | Row 1 Col 1 | Row 1 Col 2 | Row 1 Col 3 | | Row 2 Col 1 | some colspan (note the double pipe) || | Row 3 Col 1 | Row 3 Col 2 | Row 3 Col 3 |
To connect cells horizontally, just make the next cell completely empty as shown above. Be sure to have always the same amount of cell separators!
Vertical tableheaders are possible, too.
Heading 1 | Heading 2 | |
---|---|---|
Heading 3 | Row 1 Col 2 | Row 1 Col 3 |
Heading 4 | no colspan this time | |
Heading 5 | Row 2 Col 2 | Row 2 Col 3 |
As you can see, it's the cell separator before a cell which decides about the formatting:
| ^ Heading 1 ^ Heading 2 ^ ^ Heading 3 | Row 1 Col 2 | Row 1 Col 3 | ^ Heading 4 | no colspan this time | | ^ Heading 5 | Row 2 Col 2 | Row 2 Col 3 |
You can have rowspans (vertically connected cells) by adding :::
into the cells below the one to which they should connect.
Heading 1 | Heading 2 | Heading 3 |
---|---|---|
Row 1 Col 1 | this cell spans vertically | Row 1 Col 3 |
Row 2 Col 1 | Row 2 Col 3 | |
Row 3 Col 1 | Row 2 Col 3 |
Apart from the rowspan syntax those cells should not contain anything else.
^ Heading 1 ^ Heading 2 ^ Heading 3 ^ | Row 1 Col 1 | this cell spans vertically | Row 1 Col 3 | | Row 2 Col 1 | ::: | Row 2 Col 3 | | Row 3 Col 1 | ::: | Row 2 Col 3 |
You can align the table contents, too. Just add at least two whitespaces at the opposite end of your text: Add two spaces on the left to align right, two spaces on the right to align left and two spaces at least at both ends for centered text.
Table with alignment | ||
---|---|---|
right | center | left |
left | right | center |
xxxxxxxxxxxx | xxxxxxxxxxxx | xxxxxxxxxxxx |
This is how it looks in the source:
^ Table with alignment ^^^ | right| center |left | |left | right| center | | xxxxxxxxxxxx | xxxxxxxxxxxx | xxxxxxxxxxxx |
Note: Vertical alignment is not supported.
Displaying Blank Rows
Sometimes its handy to be able to space data out in a table with a blank row. Currently DokuWiki outputs HTML for the blank row, however some browsers may not display the row as it has no non-whitespace content.
Since this is a matter of presentation (but not markup) the CSS should be adjusted accordingly: The “empty-cells
” CSS keyword is supposed to be used to show/hide those cells.
Or as a “hack”, you could also try this in the table itself:
^Header1^Header2^Header3^Header4^ |field1 | field2 |field3 |field4| | \\ |||| |field1 | field2 |field3 |field4|
The resulting Table
Header1 | Header2 | Header3 | Header4 |
---|---|---|---|
field1 | field2 | field3 | field4 |
|
|||
field1 | field2 | field3 | field4 |
Background Cell Color
A background color is introduced by @
and ended by :
.
You can use all names and color codes from HTML.
If you don't specify a color, yellow is used.
See examples below:
^ Header 1 ^ Header 2 ^ Header 3 ^ | @lightgreen:**Span** || | | @#6495ed:Ligne 1 | Oui | Oui, à valider | | Ligne 2 | Oui | @orange: Oui | | @:Ligne 3 | Oui | @red:Non |
Header 1 | Header 2 | Header 3 |
---|---|---|
Span | ||
Ligne 1 | Oui | Oui, à valider |
Ligne 2 | Oui | Oui |
Ligne 3 | Oui | Non |
| @palegreen:Validé | @orange:À valider | @red:Non fonctionnel |
Validé | À valider | Non fonctionnel |