Authors can use Markdown Tables. Tables can also be used to render charts on presentation slides.
General Format
- Every column of the table starts with a pipe symbol (
|
) - The last column can also end with a pipe symbol
- Options can be specified after the last column of the first line
- The first line of the table can either contain "Column Specifications" or "Headings" (see below)
- The columns of a table do not have to be aligned
Column Specifications and Headings
Column specifications (called "delimiter row" in Github Flavored Markdown) are defined in a line where all columns only contain hyphens (-
), colons (:
) and whitespace characters. They are not optional: Every table must contain column specifications as either the first or the second line. So, this table has valid column specifications:
| Value | Series 1 | Series 2 |
| ----- | -------- | -------- |
And this table also has valid column specifications:
| - | ----- | - | --- |
The following table is not valid because it does not contain column specifications:
| 1 | 2 | 3 | 4 |
... and the next table is not valid because the column specifications are neither in the first nor in the second row:
| a | b | c | d |
| 1 | 2 | 3 | 4 |
| - | ----- | - | --- |
If the first row contains data (and thus the second row contains the column specifications), the first row defines the table's headings:
| Value | Series 1 | Series 2 |
| ----- | -------- | -------- |
"Value", "Series 1" and "Series 2" are rendered as the headings of the three columns of this table.
Column Alignment
Use colons (:
) in the columns specification to define the alignment of table columns:
- A column starting with a colon (
:---
) is left-aligned - A column ending with a colon (
---:
) is right-aligned - A column both starting and ending with a colon (
:---:
) is centered
| Left | Centered | Right |
| :--- | :------: | ----: |
Options
If you want to add Options to your table (which is especially useful when you want to render the data as a chart), you can do so after the first line. Both of the two tables below contain valid options:
| Value | Series 1 | Series 2 |{option1=value1;option1=value1}
| ----- | -------- | -------- |
| foo | 1 | 2 |
| ----- | -------- | -------- |{option1=value1;option1=value1}
| foo | 1 | 2 |
Content and Alignment
Content in tables does not have to be aligned. Also, adding spaces before and after the data in a column is not strictly necessary. The pipe symbol after the last column can be left out.
The two tables below render exaclty the same, but the second one is easier to create and change:
| Value | Series 1 | Series 2 |
| ----- | -------- | -------- |
| foo | 1 | 200 |
| Value | Series 1 | Series 2
|-|-|-
|foo|1|200|