Skip to content

Tables

A table in Markdown consists of two parts: the header and the rows of data in the table. As per the Markdown spec:

  • pipe (|) character separates the individual columns in a table.
  • (-) hyphens act as a delimiter row to separate the header row from the body.
  • (:) colon to align cell contents.
Table Example
| **Option** | **Description**                            |
| ---------- | ------------------------------------------ |
| data       | path to data files to supply the data.     |
| engine     | engine to be used for processing templates |
| ext        | extension to be used for dest files.       |

Result:

Option Description
data path to data files to supply the data.
engine engine to be used for processing templates
ext extension to be used for dest files.

Column Alignment

If you want to align a specific column to the left, center or right, you can use the [regular Markdown syntax] placing : characters at the beginning and/or end of the divider.

=== "Left"

``` markdown hl_lines="2" title="Data table, columns aligned to left"
| Method      | Description                          |
| :---------- | :----------------------------------- |
| `GET`       | :material-check:     Fetch resource  |
| `PUT`       | :material-check-all: Update resource |
| `DELETE`    | :material-close:     Delete resource |
```

Result:

Method Description
GET Fetch resource
PUT Update resource
DELETE Delete resource

=== "Center"

``` markdown hl_lines="2" title="Data table, columns centered"
| Method      | Description                          |
| :---------: | :----------------------------------: |
| `GET`       | :material-check:     Fetch resource  |
| `PUT`       | :material-check-all: Update resource |
| `DELETE`    | :material-close:     Delete resource |
```

Result:

Method Description
GET Fetch resource
PUT Update resource
DELETE Delete resource

=== "Right"

``` markdown hl_lines="2" title="Data table, columns aligned to right"
| Method      | Description                          |
| ----------: | -----------------------------------: |
| `GET`       | :material-check:     Fetch resource  |
| `PUT`       | :material-check-all: Update resource |
| `DELETE`    | :material-close:     Delete resource |
```

Result:

Method Description
GET Fetch resource
PUT Update resource
DELETE Delete resource