Merged table cells in Markdown (rowspan and colspan) for Word and PDF
Short answer: write the table in HTML inside your Markdown file and use rowspan and colspan. md-to-pdf-word turns it into a real table with merged cells in both the Word document and the PDF.
Why pipe tables are not enough
Pipe tables (| a | b |) are quick to write but have no way to say “this cell spans two rows”. Some editors add their own extensions, but they rarely survive a conversion to Word.
The HTML way
<table>
<caption>Quarterly results</caption>
<tr><th rowspan="2">Product</th><th colspan="2">2026</th></tr>
<tr><th>Revenue</th><th>Profit</th></tr>
<tr><td>Alpha</td><td>1,200</td><td>310</td></tr>
<tr><td>Beta</td><td>860</td><td>140</td></tr>
</table>
rowspan="2"merges a cell downwards,colspan="2"merges it to the right.<caption>becomes a numbered table title (“Table 1”).- The first rows made of
<th>cells become the header, repeated at the top of each page in Word. - Inside cells you can still use bold text, colors and links.
Grid tables
If you prefer plain text, grid tables also support merged cells:
+---------+--------+--------+
| Product | Revenue| Profit |
+=========+========+========+
| Alpha | 1,200 | 310 |
+---------+--------+--------+
Convert
Paste or drop the Markdown into the Markdown to Word converter (or Markdown to PDF). In Word the merged cells are real merged cells — you can keep editing the table.
Tips
- Keep each table under a heading or caption so readers can refer to it.
- Very wide tables fit the page automatically; for extremely wide ones, put them between
::: landscapeand:::to print that page in landscape.