XML technologies / Other markup languages / Markdown in publishing / Tables
For tables, distinguishing between Markdown variants is particularly important. A GFM pipe table is a relatively simple model with a header row and inline content. Pandoc understands additional table forms and can also build more complex native table structures. A raw HTML block is yet another mechanism.
The following eight examples increase complexity step by step. They show not only the desired rendering, but also different sources for the same basic principle. What matters are recognized cells, their spans, the assignment of header and data cells and the preservation of block content. S09, S11
The uploaded reference document shows, among other things, lists, code, images and nested tables in cells. This implies a requirement for a publishing process, but not a claim about a specific Markdown parser. The following test cases were newly created and processed with the Pandoc mentioned in the protocol. [S00]
Example 31: Pipe table with alignment
GFM, formal profile
Vertical bars separate the cells. A separator line sits between the header and the table body. A colon on the left specifies left alignment, on the right right alignment, and on both sides centering. The three columns show all variants. The spaces in the source text make it easier to read but do not exactly determine the later column width.
SOURCE
| Edition | Language | Copies |
|:--------|:--------:|-------:|
| Print | English | 250 |
| EPUB | English | 480 |RENDERED RESULT
The header row is required for this table form. In an HTML check, real table cells and alignment specifications should be verifiable. The fact that an editor visually aligns the bars is not a substitute for a recognized table model. CommonMark without extensions does not recognize this pipe table as a table.
Example 32: Formatted cells and a literal bar
GFM, formal profile
Pipe cells can contain inline markup such as emphasis, code and links. The vertical bar inside a|b must be escaped with a backslash in this GFM table so that it does not act as a cell boundary. This applies here even inside the backticks.
SOURCE
| Item | Meaning |
|:-----|:--------|
| **Approved** | Ready for release |
| `a\|b` | A literal pipe in code |
| [Manual](https://example.org) | External link |RENDERED RESULT
A long cell may be visually wrapped by the renderer. This is not the same as multiple paragraphs, a list or a code block in a cell. An additional source line normally creates a new table row in pipe tables, not the continuation of the same cell. A different table form is required for block content.
Example 33: Pandoc Simple Table
Pandoc Markdown
Simple Tables use aligned text columns and sequences of hyphens instead of vertical cell boundaries. Here the first column is left-aligned and the second right-aligned. The position of the header texts relative to the separator lines is part of the interpretation. A final line and a following blank line make the end of the table clear.
SOURCE
Edition Copies
----------- -------
Print 250
EPUB 480
----------- -------RENDERED RESULT
This syntax is more sensitive to changed spaces than a pipe table. An editor with a proportional font or automatic reformatting can make the source confusing. Simple Tables are suitable for short, single-line cell contents, not for arbitrary editorial blocks.
Example 34: Multi-line table cells
Pandoc Markdown
A Multiline Table allows a cell text to be distributed across several source lines. In this example, blank lines separate the two data records. An upper and a lower boundary as well as carefully aligned columns help the parser with recognition.
SOURCE
--------------------------------------------
Edition Editorial note
----------- -------------------------------
Print Includes a revised
introduction.
EPUB Includes accessible
navigation.
--------------------------------------------
Table: Notes for each edition.RENDERED RESULT
The text lines of a cell do not form independent paragraphs. Nor do they create row or column spans. The line Table: here uses Pandoc's caption function to create a table caption. A local pipe table and a multiline table with a caption are therefore not the same syntax with a different appearance.
Example 35: Grid table with list and paragraph
Pandoc Markdown
Grid tables draw the cell boundaries with plus signs, hyphens and vertical bars. The equals signs separate the header from the body. In the right-hand cell, a real list and a following paragraph are parsed. This makes this table form considerably more expressive than a pipe table.
SOURCE
+-------------+--------------------------+
| Edition | Review tasks |
+=============+==========================+
| Print | - Check the cover. |
| | - Check the references. |
| | |
| | Approval is required. |
+-------------+--------------------------+RENDERED RESULT
The vertical boundaries must remain exactly aligned. A shifted line can create additional columns or a different cell structure without aborting the entire conversion process. Our test therefore not only counts tables, but also checks the list within a data cell.
Example 36: Merged cells in a grid table
Pandoc Markdown
The header cell "Publication" spans two logical columns. The cell "Guide" spans two rows. The interruptions in the drawn cell boundaries express these spans. In HTML, these become colspan and rowspan.
SOURCE
+---------------------+----------+
| Publication | Copies |
+=============+=======+==========+
| | Print | 200 |
| Guide +-------+----------+
| | EPUB | 450 |
+-------------+-------+----------+RENDERED RESULT
The blanket statement "Markdown cannot do merged cells" would therefore be incorrect. It applies to simple GFM pipe tables, not to every extended Markdown dialect. Nevertheless, exact parser and writer versions as well as the target format remain important. The tests here check the actual spans. Merely successful file generation would not be sufficient for this.
Example 37: HTML table with explicit semantics
Pandoc Markdown
The addition {=html} explicitly marks the entire Block as raw HTML output. caption and scope here carry information about captions and header cells. The HTML output can preserve this information.
SOURCE
```{=html}
<table>
<caption>Edition totals</caption>
<tr><th scope="col">Edition</th><th scope="col">Copies</th></tr>
<tr><th scope="row">Print</th><td>250</td></tr>
</table>
```RENDERED RESULT
The example is deliberately an edge case: an HTML block stored as a RawBlock is not a native Pandoc table. When writing a DOCX, it is not automatically converted into a Word table and may be omitted entirely. Parsing the HTML first with an HTML reader is a different processing path. The report therefore distinguishes successful HTML rendering from missing portable structure.
Example 38: A table inside a table cell
Pandoc Markdown
A grid cell can contain further block structures. The example uses this for an inner grid table. Whether the desired nesting has actually been created can be checked in the document tree and by a table inside an HTML data cell.
SOURCE
+----------+-----------------------------+
| Topic | Details |
+==========+=============================+
| Editions | +----------+--------+ |
| | | Format | Copies | |
| | +==========+========+ |
| | | Print | 250 | |
| | +----------+--------+ |
+----------+-----------------------------+RENDERED RESULT
Technical representability does not automatically mean good author-friendliness or accessibility. The source is significantly more difficult to edit than a simple table. In production, it should also be checked whether the inner table is meaningfully preserved in DOCX, EPUB, and the print output. For more complex holdings, an explicit HTML or XML table model may be the better editable source.
A "protected table" can mean two completely different requirements. Edit or copy protection is a function of the application or the output format, not of the Markdown table syntax. A table that should not be split when printing, on the other hand, requires layout rules. CSS such as break-inside: avoid can help avoid a page break, but does not guarantee this for a table that is taller than an entire page. Repeated table headers, column widths, and page breaks must be checked in the respective output process.
Complex tables should therefore not be categorically divided into "works" and "does not work". The concrete question is: Which structure can this input syntax express, does our reader recognize it correctly, and does the chosen writer preserve it with the required semantics?







