8.9 Tables
When creating tables using Markdown, pipes |
separate columns while line breaks are used to separate rows. The column header is separated by three or more hyphens ---
between each column's pipe |
. A colon :
can be added to the left of the hyphens to left align the column, to the right to right align, and on both ends to centre. The following example is left aligned.
Input
| Column 1 Header | Column 2 Header | Column 3 Header |
| :--- | :--- | :--- |
| Column 1 item | Column 2 item | Column 3 item |
| Column 1 item | Column 2 item | Column 3 item |
Output
Column 1 Header | Column 2 Header | Column 3 Header |
---|---|---|
Column 1 item | Column 2 item | Column 3 item |
Column 1 item | Column 2 item | Column 3 item |
NOTE
- The number of hyphens,
-
, used can make the cell width look incorrect. However, as long as there are three or more hyphens the rendered output will be the same. - Put a space, " ", between each pipe
|
and the following word or dash-