Markdown Tables
Tables are not part of the original Markdown specification, but they are supported by almost all modern Markdown processors, including GitHub Flavored Markdown (GFM).
Markdown tables correspond to the HTML table tag, with rows (tr), headers (th), and data cells (td).
Basic Table Syntax
To create a table, use pipes | to separate columns, and three or more hyphens --- to create the header row. Pipes on the edges of the table are optional but usually recommended for clarity.
Cell Alignment
You can align text in the columns to the left, right, or center by adding colons (:) to the hyphen line.
- Left Aligned:
:---(Colon on the left) - Right Aligned:
---:(Colon on the right) - Center Aligned:
:---:(Colons on both sides)
Formatting Text in Tables
You can format text within your tables using other Markdown syntax like links, code snippets, and emphasis.
Table Tips
- Cell Consistency: While you don't have to align the pipes in your raw text editor for the table to render correctly, doing so makes the source much easier to read.
- Line Breaks: Most Markdown parsers do not support multiple paragraphs or line breaks within a single table cell. If you need complex layouts, you might need to use HTML tables instead.
- Spacing: Ensure there is a blank line before the table starts so that the parser recognizes it as a separate block.