TABLES ARE PERFECT TO DISPLAY STRUCTURED DATA IN ROWS AND COLUMNS. MULTIMARKDOWN SUPPORTS THE GENERATION OF TABLES BY USING A COUPLE OF SIMPLE RULES ALONGSIDE THE USE OF THE PIPE CHARACTER – |.
| First Header | Second Header | Third Header | | :------------ | :-----------: | -------------------: | | First row | Data | Very long data entry | | Second row | **Cell** | *Cell* | | Third row | Cell that spans across two columns || [Table caption, works as a reference][section-mmd-tables-table1]
|FIRST HEADER||SECOND HEADER||THIRD HEADER|
|First row||Data||Very long data entry|
|Third row||Cell that spans across two columns|
If you are familiar with HTML tables, you’ll instantly recognize the structure of the table syntax. All tables must begin with one or more rows of headers, and each row may have one or more columns.
These are the most important rules you’ll be dealing with:
- There must be at least one
- After the header rows, there must be a line containing only
., or spaces;
- Cell content must be on one line only;
- Columns are separated by
To align the data cells on the table, you need to introduce a special row right after the headers, that will determine how the following rows – the data rows – will be aligned.
| Header One | Header Two | Header Three | Header Four | | ---------- | :--------- | :----------: | ----------: | | Default | Left | Center | Right |
|HEADER ONE||HEADER TWO||HEADER THREE||HEADER FOUR|
The placing of the colon (
:) is optional and determines the alignment of columns in the data rows. This line is mandatory and must be placed between the headers and the data rows.
Also, the usage of the
| at the beginning or end of the rows is optional – as long as at least one
| is present in each row.
To make a cell span across multiple columns, instead of using a single pipe (
|) character to delimit that cell, use the number of pipes corresponding to the columns you wish to span.
| Column 1 | Column 2 | Column 3 | Column 4 | | -------- | :------: | -------- | -------- | | No span | Span across three columns |||
|COLUMN 1||COLUMN 2||COLUMN 3||COLUMN 4|
|No span||Span across three columns|
This is only an introduction to MultiMarkdown’s tables. For the full reference, please refer to the “Tables” section on the MultiMarkdown user guide.