mirror of
https://github.com/jgm/pandoc.git
synced 2026-07-11 11:57:16 +00:00
41f829c43d
Like the other table syntaxes (pipe, simple, and multiline tables) and block-level constructs generally, a grid table may now be indented by up to three spaces and still be recognized as a table. Previously the grid-table parser required the table to begin at the left margin, so an indented grid table was parsed as a paragraph. The leading indentation is stripped uniformly from each line before the table is parsed, so an indented grid table produces the same AST as its non-indented equivalent. Adds a command test.
953 B
953 B
Like other block-level constructs, grid tables may be indented by up to three spaces and are still recognized as tables.
% pandoc -f markdown -t html
+---+---+
| a | b |
+===+===+
| 1 | 2 |
+---+---+
^D
<table style="width:11%;">
<colgroup>
<col style="width: 5%" />
<col style="width: 5%" />
</colgroup>
<thead>
<tr>
<th>a</th>
<th>b</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>2</td>
</tr>
</tbody>
</table>
A headerless indented grid table is recognized too.
% pandoc -f markdown -t html
+------+------+
| foo | bar |
+------+------+
^D
<table style="width:19%;">
<colgroup>
<col style="width: 9%" />
<col style="width: 9%" />
</colgroup>
<tbody>
<tr>
<td>foo</td>
<td>bar</td>
</tr>
</tbody>
</table>
A grid table indented four spaces is a code block, not a table.
% pandoc -f markdown -t html
+---+---+
| a | b |
+---+---+
^D
<pre><code>+---+---+
| a | b |
+---+---+</code></pre>