Skip to main content

Table Formatting in Docusaurus

Docusaurus supports both standard Markdown tables and advanced HTML tables. Each has its own strengths depending on your use case.


1. Standard Markdown Table (Comparison)

Markdown tables are perfect for simple data comparisons. They are easy to read and maintain in the source code.

FeatureStandard MarkdownHTML/JSX
Ease of UseVery EasyModerate
ComplexityLowHigh
Cell SpanningNoYes
Custom StylingLimitedFlexible
| Feature | Standard Markdown | HTML/JSX |
| :--- | :---: | :---: |
| **Ease of Use** | Very Easy | Moderate |
| **Complexity** | Low | High |

2. Styled Markdown Table (Pricing)

You can use alignment markers (:---, :---:, ---:) to control text flow and include inline formatting.

Service TierStorageBandwidthPrice
Basic5GB100GB$0.00
Pro50GB1TB$10.99
EnterpriseUnlimitedUnlimitedContact Us

| Service Tier | Storage | Bandwidth | Price |
| :--- | :--- | :--- | ---: |
| **Basic** | 5GB | 100GB | `$0.00` |
| **Pro** | 50GB | 1TB | `$10.99` |
| **Enterprise** | <mark>Unlimited</mark> | <mark>Unlimited</mark> | `Contact Us` |

3. Basic HTML Table (Custom Layout)

HTML tables allow you to wrap content differently and provide more structural control.

IDStatusDescription
#101ActiveStandard user account
#102LockedSuspicious activity detected
<table>
<thead>
<tr style={{backgroundColor: '#e3f2fd'}}>
<th>ID</th>
<th>Status</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>#101</td>
<td><span style={{color: 'green'}}>Active</span></td>
<td>Standard user account</td>
</tr>
<tr>
<td>#102</td>
<td><span style={{color: 'red'}}>Locked</span></td>
<td>Suspicious activity detected</td>
</tr>
</tbody>
</table>

4. Advanced HTML Table (Merged Cells)

HTML is required when you need to merge rows or columns using rowSpan and colSpan.

TimeMondayTuesdayWednesday
09:00 - 10:00Deep Work SessionPlanningCode Review
10:00 - 11:00Design SyncStandup
11:00 - 12:00Weekly General Meeting (All Teams)

<table className="advanced-table">
<thead>
<tr style={{backgroundColor: '#f5f5f5'}}>
<th>Time</th>
<th>Monday</th>
<th>Tuesday</th>
<th>Wednesday</th>
</tr>
</thead>
<tbody>
<tr>
<td>09:00 - 10:00</td>
<td rowSpan="2" style={{verticalAlign: 'middle', textAlign: 'center', backgroundColor: '#fff9c4'}}>
<b>Deep Work Session</b>
</td>
<td>Planning</td>
<td>Code Review</td>
</tr>
<tr>
<td>10:00 - 11:00</td>
<td>Design Sync</td>
<td>Standup</td>
</tr>
<tr>
<td>11:00 - 12:00</td>
<td colSpan="3" style={{textAlign: 'center', backgroundColor: '#e1f5fe'}}>
<i>Weekly General Meeting (All Teams)</i>
</td>
</tr>
</tbody>
</table>

5. Table with Components (Rich Content)

Since we are using MDX, we can embed React components directly inside table cells.

Documentation PathCurrent StatusAction
/docs/setupSTABLEView Source
/docs/experimentalBETAView Source
/docs/legacyDEPRECATEDView Source
| Documentation Path | Current Status | Action |
| :--- | :--- | :---: |
| `/docs/setup` | <StatusBadge type="stable" /> | [View Source](...) |

Best Practices

  1. Use Markdown for 90% of your tables to keep the code clean.
  2. Use HTML only when you need complex cell spanning or highly specific inline styling.
  3. Keep it Responsive: Very wide tables may break layouts on mobile. Consider splitting data into smaller tables if possible.