Skip to content

Column widths set in a table directive are ignored. #793

@jhcole

Description

@jhcole

What version of myst-parser are you using?

2.0.0

What version dependencies are you using?

$ pip list | grep -e phinx -e docu
docutils                      0.19
pydata-sphinx-theme           0.13.0rc4
Sphinx                        6.2.1
sphinx-autodoc2               0.4.2
sphinx-book-theme             1.0.0rc2
sphinx-copybutton             0.5.2
sphinx-design2                0.4.0
sphinx_pyscript               0.1.0
sphinx_pytest                 0.1.1
sphinx_tippy                  0.4.1
sphinx-togglebutton           0.3.2
sphinxcontrib-applehelp       1.0.4
sphinxcontrib-devhelp         1.0.2
sphinxcontrib-htmlhelp        2.0.1
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-qthelp          1.0.3
sphinxcontrib-serializinghtml 1.1.5
sphinxext-opengraph           0.8.2
sphinxext-rediraffe           0.2.7

What operating system are you using?

Linux

Describe the Bug

Given this example markdown file which specified column widths, the column width information is discarded.

# example.md
```{table} *title*
:name: name
:widths: 1 2

| a | b |
|---|---|
| 1 | 2 |
```
$ myst-docutils-demo example.md 
<table id="name">
<caption><em>title</em></caption>
<thead>
<tr><th class="head"><p>a</p></th>
<th class="head"><p>b</p></th>
</tr>
</thead>
<tbody>
<tr><td><p>1</p></td>
<td><p>2</p></td>
</tr>
</tbody>
</table>

Expected Behavior

I expected the width information to be kept. For example:

$ myst-docutils-demo example.md 
<table id="name">
<caption><em>title</em></caption>
<colgroup>
<col style="width: 33.3%" />
<col style="width: 66.7%" />
</colgroup>
<thead>
<tr><th class="head"><p>a</p></th>
<th class="head"><p>b</p></th>
</tr>
</thead>
<tbody>
<tr><td><p>1</p></td>
<td><p>2</p></td>
</tr>
</tbody>
</table>

I'm currently working on a pull request which produces the expected behavior.

To Reproduce

Create this example file.

# example.md
```{table} *title*
:name: name
:widths: 1 2

| a | b |
|---|---|
| 1 | 2 |
```

Then run it like this

$ myst-docutils-demo example.md 

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions