jgm / pandoc

Universal markup converter
https://pandoc.org
Other
34.51k stars 3.37k forks source link

Simple table fails to align right if containing wide characters #6021

Open atusy opened 4 years ago

atusy commented 4 years ago

I am using Pandoc 2.9.1 and converted a following a markdown simple table to html. The 2nd column of the table is ought to be right-aligned, however, it turns out to be center-aligned. I guess this is because the second column contains wide characters (twice the width of narrow characters like ASCII), and Pandoc treats them as narrow characters.

Oxide      石英
-------  ------
SiO2        100

Result:

<table>
<thead>
<tr class="header">
<th style="text-align: left;">Oxide</th>
<th style="text-align: center;">石英</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="text-align: left;">SiO2</td>
<td style="text-align: center;">100</td>
</tr>
</tbody>
</table>

Workaround

Adding one space per one wide char

Oxide        石英
-------  ------
SiO2        100
jgm commented 4 years ago

Thanks for reporting. We do take into account wide characters, but perhaps not everywhere we need to.