-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Description
Using latest pandoc-nightly-windows-2025-05-20
.
The table
+----------+----+
| h1 | h2 |
+:===:+===:+:===+
| A | B |
+-----+----+----+
| C | D | E |
+-----+----+----+
will give the following correct alignments in the AST when read:
[ ( AlignCenter , ColWidth 8.333333333333333e-2 )
, ( AlignRight , ColWidth 6.944444444444445e-2 )
, ( AlignLeft , ColWidth 6.944444444444445e-2 )
]
However, when written as a grid_table, we get:
+-------------+----+
| h1 | h2 |
+:===========:+:===+
| A | B |
+------+------+----+
| C | D | E |
+------+------+----+
So we lost the right-alignment on the second column (which should affect cell D for example).
The expected result should look like the original table.
For the table:
+-----+----+----+
| h1 | h2 | h3 |
+:===:+===:+:===+
| A | B |
+-----+----+----+
| C | D | E |
+-----+----+----+
we get:
+------+------+----+
| h1 | h2 | h3 |
+:=====+=====:+:===+
| A | B |
+------+------+----+
| C | D | E |
+------+------+----+
which is also problematic: the first column is now left-align.
For the table:
+----------+----+
| h1 | h2 |
+:===:+===:+:===+
| A | F | B |
+-----+----+----+
| C | D | E |
+-----+----+----+
we get a proper result.
So it's the influence of the cell colspan below which cause trouble, at least in these examples.
The alignments being a global property of the table, they should not be affected by nearby cell colspans.
A suggestion would be to always write all the alignements segments on the header separator/border.
As a compromise, one could relax this when there is no ambiguïty (eg for default aligns on columns affected by nearby colspans).