Markdown Tables to HTML table Tags
Convert Markdown pipe tables to HTML <table>, <thead>, <tbody>, <tr>, <th>, and <td> tags. Includes column alignment, formatting within cells, and limitations.
Detailed Explanation
Markdown Tables to HTML
Markdown tables (part of GitHub Flavored Markdown) use pipes (|) and hyphens (-) to define rows and columns. They convert to full HTML <table> structures.
Basic Table
| Name | Age | Role |
|---------|-----|------------|
| Alice | 30 | Developer |
| Bob | 25 | Designer |
Converts to:
<table>
<thead>
<tr>
<th>Name</th>
<th>Age</th>
<th>Role</th>
</tr>
</thead>
<tbody>
<tr>
<td>Alice</td>
<td>30</td>
<td>Developer</td>
</tr>
<tr>
<td>Bob</td>
<td>25</td>
<td>Designer</td>
</tr>
</tbody>
</table>
The first row becomes the table header (<thead> with <th> elements), and all subsequent rows become the table body (<tbody> with <td> elements).
Column Alignment
Use colons in the separator row to control alignment:
| Left | Center | Right |
|:-------|:------:|------:|
| A | B | C |
This adds style="text-align: ..." or an alignment class to the <th> and <td> elements:
:---= left-aligned:---:= center-aligned---:= right-aligned
Inline Formatting in Tables
You can use bold, italic, inline code, and links inside table cells:
| Feature | Status |
|---------------|------------|
| **Auth** | `Done` |
| *Search* | In Progress|
Limitations
Markdown tables do not support cell spanning (colspan/rowspan), multi-line cell content, or nested tables. For complex layouts, use raw HTML within your Markdown.
Use Case
Tables are essential for API documentation (parameter descriptions), comparison charts, feature matrices, changelogs, and any structured data presentation in Markdown-based documentation and README files.