Markdown tables
A Markdown table is rows of cells separated by pipes (|), with a row of dashes under the header. Tables come from GitHub-flavoured Markdown and work on GitHub, GitLab, in Hashlite and in most modern editors.
Basic syntax
| Name | Role |
| ----- | -------- |
| Ada | Engineer |
| Grace | Admiral |
| Name | Role |
|---|---|
| Ada | Engineer |
| Grace | Admiral |
- The first row is the header. It is required.
- The second row is the delimiter row: at least one dash per column (three is common). It needs the same number of cells as the header.
- The pipes at the start and end of a row are optional, and the columns do not have to line up.
- Leave a blank line before and after the table.
Column alignment
Colons in the delimiter row set the alignment: :--- left, :---: center, ---: right. Right-align columns of numbers so the digits line up.
| Item | Qty | Price |
| :----- | :-: | ----: |
| Coffee | 2 | 3.50 |
| Bagel | 1 | 12.25 |
| Item | Qty | Price |
|---|---|---|
| Coffee | 2 | 3.50 |
| Bagel | 1 | 12.25 |
Formatting inside cells
Inline Markdown works in cells: bold, italic, code, links and images. Block elements such as lists, headings and code blocks do not.
| Feature | Status |
| --------- | ------------- |
| **Login** | ~~Beta~~ Done |
| `export` | [Docs](/guide) |
| Feature | Status |
|---|---|
| Login | |
export |
Docs |
Escaping pipes
A pipe inside a cell ends the cell. Write \| to show a literal pipe; this also works inside inline code.
| Operator | Meaning |
| -------- | ----------- |
| `a \|\| b` | logical OR |
| x \| y | a pipe |
| Operator | Meaning |
|---|---|
a || b |
logical OR |
| x | y | a pipe |
Line breaks in a cell
Each row must stay on one line. For a line break inside a cell, use the HTML tag <br>.
| Step | Notes |
| ---- | ---------------------------- |
| 1 | Install<br>Then restart |
| Step | Notes |
|---|---|
| 1 | Install Then restart |
Merged cells
Markdown has no syntax for merged cells. Where HTML is allowed (GitHub, Hashlite and most editors), write an HTML table and use colspan or rowspan.
<table>
<tr><th>Quarter</th><th colspan="2">Sales</th></tr>
<tr><td rowspan="2">Q1</td><td>Jan</td><td>120</td></tr>
<tr><td>Feb</td><td>135</td></tr>
</table>
| Quarter | Sales | |
|---|---|---|
| Q1 | Jan | 120 |
| Feb | 135 | |
Tips
- Don't align by hand. Spacing is ignored, so only line columns up if it helps you read the source.
- No header wanted? Leave the header cells empty:
| | |followed by|---|---|. - Keep cells short. Long text makes tables scroll on phones; put details in a list below the table.
- Empty cell? Just leave it blank between two pipes. Missing cells at the end of a row are filled in as empty.
Try it in Hashlite: open the free editor and see the result as you type.