Making Tables in Markdown

The easiest way to compose posts (topics and replies) is using the Markdown language. Markdown allows you to use “rich text” features such as bold and italic type, links, block quotes, insertion of images, headings, and lists simply by typing characters in text, much as people did in E-mail before the advent of rich text mail. The buttons at the top of the composition window will do many of these functions for you, inserting the Markdown codes, whose effects you can see in the live preview window at the right.

The version of Markdown used by Discourse also allows creating tables where you can line up data in columns. Again, this is done with characters that resemble a table in “ASCII art”. Here is an example of what you type to make a table:

| Item         | Price | # In stock |
| Apples       |  1.99 |        739 |
| Prunes       |  1.89 |          6 |

and this is what will be displayed in your post:

Item Price # In stock
Apples 1.99 739
Prunes 1.89 6

Be sure to type the vertical bar characters in the first column of the line. You don’t have to line everything up in your input: the following will produce the same table.

| Item | Price | # In stock |
| Apples | 1.99 | 739 |
| Prunes | 1.89 | 6 |

Both the column heading and separator lines must appear at the start of the table. Separators must be at least three hyphens. Notice the colons in the separator line. If there is no colon in a field, the column will be left justified. If there are colons at the start and end, it will be centred, and a colon only at the end will cause it to be right justified.

You can use other Markdown mark-up within columns if you, for example, want items to be bold, italic, or have links.