Files
Aslak Hellesøy 763c555a05 Markdown writer: write wide tables as grid tables.
A table was written as a grid table only if it had spans or a footer,
or if `writerColumns >= 8 * numcols`.  A wider table with block content
in a cell therefore fell back to raw HTML, even with grid_tables
enabled; with the default 72 columns that is any table of ten or more
columns.

The width check was added in ea619bfcb (2017, #2834) to fix grid
tables nested in grid tables.  The old grid writer gave each column
`floor(columns * share) - 3` characters and rendered cell contents with
`writerColumns` reduced to the column width, so nested tables got
narrower at each level.  Below about 8 characters per column those
widths reached zero or went negative and the layout broke.

The `gridTable` rewrite in 01257ef6e (pandoc 3.7) removed that failure
mode.  A column is never made narrower than its content (or, when
wrapping, than its longest unbreakable word), and cells are rendered
with unchanged `opts`, so `writerColumns` no longer shrinks for nested
content.  The RST and Muse writers already call the same `gridTable`
with no width check, and the Markdown writer already writes grid tables
wider than `columns` when a table has spans or a footer.

The check is therefore removed.  This follows the preference stated in
7c2dd0359 for markdown tables over raw HTML.  No existing test output
changes.

Closes #11945.
2026-10-10 10:46:25 -07:00

1.5 KiB

A table with more columns than columns / 8 is still written as a grid table, rather than falling back to raw HTML.

% pandoc -f html -t markdown-simple_tables-multiline_tables-pipe_tables
<table>
<tr><th>H1</th><th>H2</th><th>H3</th><th>H4</th><th>H5</th><th>H6</th><th>H7</th><th>H8</th><th>H9</th><th>H10</th></tr>
<tr><td>c1</td><td>c2</td><td>c3</td><td>c4</td><td>c5</td><td>c6</td><td>c7</td><td>c8</td><td>c9</td><td>c10</td></tr>
</table>
^D
+----+----+----+----+----+----+----+----+----+-----+
| H1 | H2 | H3 | H4 | H5 | H6 | H7 | H8 | H9 | H10 |
+====+====+====+====+====+====+====+====+====+=====+
| c1 | c2 | c3 | c4 | c5 | c6 | c7 | c8 | c9 | c10 |
+----+----+----+----+----+----+----+----+----+-----+

This includes a table with block content in a cell, which has no other markdown representation.

% pandoc -f html -t markdown
<table>
<tr><th>H1</th><th>H2</th><th>H3</th><th>H4</th><th>H5</th><th>H6</th><th>H7</th><th>H8</th><th>H9</th><th>H10</th></tr>
<tr><td><ul><li>a</li><li>b</li></ul></td><td>c2</td><td>c3</td><td>c4</td><td>c5</td><td>c6</td><td>c7</td><td>c8</td><td>c9</td><td>c10</td></tr>
</table>
^D
+------+------+------+------+------+------+------+------+------+------+
| H1   | H2   | H3   | H4   | H5   | H6   | H7   | H8   | H9   | H10  |
+======+======+======+======+======+======+======+======+======+======+
| - a  | c2   | c3   | c4   | c5   | c6   | c7   | c8   | c9   | c10  |
| - b  |      |      |      |      |      |      |      |      |      |
+------+------+------+------+------+------+------+------+------+------+