Tables
Remarks#
Tables are supported only in certain flavors of Markdown, including Markdown Extra and Github Flavored Markdown, but not in the original Markdown syntax or in CommonMark.
Markdown tables are also not supported on Stack Exchange sites (with the exception of the Documentation beta).
Creating a table
Markdown tables are physically represented using dash -
for to separate the header row from the content ones and pipe |
for columns.
Column | Column |
---|---|
Cell | Cell |
is produced by
Column | Column
------ | ------
Cell | Cell
You can also populate a table in any way you want -
Letter | Digit | Character |
---|---|---|
a | 4 | $ |
| 365 | (
b | | ^
That table’s code:
Letter | Digit | Character
------ | ------|----------
a | 4 | $
| 365 | (
b | | ^
Markdown ignores spacing. The same table could be written like this:
Letter|Digit|Character
---|---|---
a|4|$
|365|(
b| |^
and still display the same:
Letter | Digit | Character |
---|---|---|
a | 4 | $ |
365 | ( | |
b | ^ |
NOTE: if you need a void column you must add a space between the pipes
As you can see, the code of the table does not need to represent the spacing of the table - that is accomplished within the markdown.
You should want to align the content of a table. All you have to do is add some colons in this way:
Aligning the column:
:
is used to align a column. Left align is the standard.
Column | Column | Column
:----- | :----: | -----:
Left | Center | Right
align | align | align
Column | Column | Column |
---|---|---|
Left | Center | Right |
align | align | align |
Pipe in a cell content
If you want to use a pipe character (|
) in the content of a cell you’ll need to escape it with a backslash.
Column | Column
------ | ------
\| Cell \|| \| Cell \|
This results in the following table:
Column | Column |
---|---|
| Cell | | | Cell | |