How to make a table in Markdown - updated 2022

Small tables in markdown can be a good way to present data on your blog. I use it for this blog which is based on Ghost. For example I needed to show the result of a SQL query which I presented in the following way:

Id ParsedName ParsedAge ParsedHeight
06D2FD93... Peter 30 186.50

The code for the above table is the following:

| Id          | ParsedName | ParsedAge | ParsedHeight |
|-------------|------------|-----------|--------------|
| 06D2FD93... | Peter      | 30        | 186.50       |

You can write these tables on your own, but I would advise that you use an online generator, if you have more than a couple columns. For the above I have used www.tablesgenerator.com which I found randomly by searching for it. The full documentation for these tables here. My opinion is that these need to be kept rather simple, as they start to be hard to maintain if they have too many columns. Here are some more examples on features of markdown tables:

Using markdown syntax inside cells

You can use your usual markdown syntax within the cells of the table. Below I have put some text in italic, code, bold and highlighted.

Id ParsedName ParsedAge ParsedHeight
06D2FD93... Peter 30 186.50

The markdown for this is:

| Id            | ParsedName   | ParsedAge   | ParsedHeight   |
|---------------|--------------|-------------|----------------|
| *06D2FD93...* | `Peter`      | **30**      | ==186.50==     |

Aligning cells in markdown

Using a colon (:) you can set the alignment of that column like below:

Column1 Column2 Column3 Column4
left center Right Not set

The markdown for this is:

| Column1       | Column2      | Column3     | Column4        |
|---------------|:------------:|------------:|----------------|
| left          | center       | Right       | Not set        |

Wrapping it up

I hope you found this helpful, please leave a comment below if you did!

EDIT: I realised after editing this in 2022 that I am no longer 30 years old. Note to self do not use your own age in examples!