Data tables
DocsForge renders Markdown tables with enhanced styling.
Basic table
| Method | Description |
|--------|-------------|
| `GET` | Retrieve a resource |
| `POST` | Create a new resource |
| `PUT` | Update a resource |
| `DELETE` | Remove a resource |
| Method | Description |
|---|---|
GET | Retrieve a resource |
POST | Create a new resource |
PUT | Update a resource |
DELETE | Remove a resource |
Aligned columns
| Left | Center | Right |
|:-----|:------:|------:|
| L | C | R |
| left | center | right |
| Left | Center | Right |
|---|---|---|
| L | C | R |
| left | center | right |
Wide tables
For tables with many columns, wrap them in a scrollable container:
<div class="md-typeset__scrollwrap"><div class="md-typeset__table">
| Column 1 | Column 2 | Column 3 | Column 4 | Column 5 |
|----------|----------|----------|----------|----------|
| Data | Data | Data | Data | Data |
</div></div>
Tables with code
| Extension | Syntax | Description |
|-----------|--------|-------------|
| `admonition` | `!!! note` | Callout boxes |
| `attr_list` | `{: .class }` | HTML attributes |
| `pymdownx.highlight` | ` ```python ` | Code highlighting |
| Extension | Syntax | Description |
|---|---|---|
admonition | !!! note | Callout boxes |
attr_list | {: .class } | HTML attributes |
pymdownx.highlight | ```python | Code highlighting |
Tables with links
| Feature | Guide | Reference |
|---------|-------|-----------|
| Colors | [Setup](../setup/changing-the-colors.md) | — |
| Fonts | [Setup](../setup/changing-the-fonts.md) | — |
| Admonitions | — | [Reference](admonitions.md) |
| Code blocks | — | [Reference](code-blocks.md) |
| Feature | Guide | Reference |
|---|---|---|
| Colors | Setup | — |
| Fonts | Setup | — |
| Admonitions | — | Reference |
| Code blocks | — | Reference |
CSV tables
For complex data, consider using the tables extension or importing from CSV:
markdown_extensions:
- tables
Styling
Apply CSS classes to tables:
| Header 1 | Header 2 |
|----------|----------|
| Cell 1 | Cell 2 |
{: .highlight }
Table sorting
For interactive sorting, add the data-table class:
| Name | Age | Role |
|------|-----|------|
| Alice | 30 | Developer |
| Bob | 25 | Designer |
| Carol | 35 | Manager |
{: data-table }
Multi-line cells
Use <br> for line breaks within cells:
| Feature | Description |
|---------|-------------|
| Search | Full-text search<br>with highlighting |
| Dark mode | Light and dark<br>themes included |
| Feature | Description |
|---|---|
| Search | Full-text search with highlighting |
| Dark mode | Light and dark themes included |
Best practices
- Keep tables under 10 columns for readability
- Use
|--------|alignment for visual consistency - Always include a header row for accessibility
- Use
(space) for empty cells, not|| - Wrap wide tables in scrollable containers