Skip to content

Markdown table syntax

Markdown table syntax provides a way to organize data into rows and columns using standard text characters. It supports basic structuring, cell alignment, and the omission of empty cells^[100-InBox__test-templater.md].

Syntax Structure

Tables are constructed using pipe characters (|) to separate columns and hyphens (-) to define the header separator^[100-InBox__test-templater.md].

  • Rows: Each row of the table is placed on a new line.
  • Columns: Columns are separated by the pipe symbol (e.g., | first | 2 |).
  • Header Separator: The header row must be immediately followed by a separator line containing hyphens for each column (e.g., | ----- | ---- |)^[100-InBox__test-templater.md]. This line strictly separates the column headers from the table body; any text in the body is treated as content, not a header^[100-InBox__test-templater.md].

Alignment and Formatting

The hyphens in the separator line can be combined with colons (:) to specify text alignment within a column^[100-InBox__test-templater.md].

  • Left-aligned: Colons are placed on the left side of the hyphens (e.g., :-----).
  • Right-aligned: Colons are placed on the right side of the hyphens (e.g., ----:).
  • Center-aligned: Colons are placed on both sides (e.g., :----:).

The visual rendering of the table typically handles spacing and column widths automatically, allowing the raw text to remain legible^[100-InBox__test-templater.md].

Content Handling

Tables are capable of handling varying content lengths and structures.

  • Variable Content: Cells may contain short text or longer strings, and the table structure will adjust to accommodate the content^[100-InBox__test-templater.md].
  • Empty Cells: Markdown parsers allow for the omission of content where a cell might otherwise be empty^[100-InBox__test-templater.md].

Example

The following example illustrates a basic table with varying content lengths and a standard header separator^[100-InBox__test-templater.md]:

| first | 2    | 4                  |
| ----- | ---- | ------------------ |
| dd    | d    | ddd                |
| fsd   | dasd | dsaaaaaaaaaaaaaaaa |

Sources

  • 100-InBox__test-templater.md