pradyunsg / furo

A clean customizable documentation theme for Sphinx
https://pradyunsg.me/furo/quickstart
MIT License
2.76k stars 317 forks source link

Table cell's content is not centered despite `|:---:|` forced alignment #278

Closed kdeldycke closed 3 years ago

kdeldycke commented 3 years ago

What's happening?

Here is a table in MyST:

| Column | Left-aligned | Centered | Right-aligned |
|--------|:-------------|:--------:|--------------:|
| 1      | 2            | 3        | 4             |
| A      | B            | C        | D             |

I expect the content of the first and second column to be left-aligned, the third column to be centered and the last one to be right aligned.

Unfortunately all cells ends up left-aligned.

Here is the HTML produced for a row:

<tr class="row-odd">
    <td>
        <p>A</p>
    </td>
    <td class="text-align:left">
        <p>B</p>
    </td>
    <td class="text-align:center">
        <p>C</p>
    </td>
    <td class="text-align:right">
        <p>D</p>
    </td>
</tr>

See how the alignment gets hard-coded in the form of a class attribute? This seems to be fixed if I manually edit each <td> tag and replace class= by style=.

Reproducer

  1. Go to the auto-generated Sphinx documentation at https://kdeldycke.github.io/meta-package-manager/#supported-package-managers and see how all tickmarks in the table are left-aligned.
  2. Compare the rendered table above with the original source at https://github.com/kdeldycke/meta-package-manager/blob/develop/readme.md?plain=1#L48 in which all columns containing tickmarks are constrained to be centered.
  3. Compare how GitHub render that same table, respecting the alignment: https://github.com/kdeldycke/meta-package-manager#supported-package-managers

Expectation

Here I expect the contant of each column to respect the alignment constraint defined in Markdown between the header of the table and its rows.

Code of Conduct

pradyunsg commented 3 years ago

This sounds like a bug to file against myst-parser.

/cc @choldgraf