MyST-Parser icon indicating copy to clipboard operation
MyST-Parser copied to clipboard

Explicit link in table in eval-rst is incorrectly implicit

Open tucked opened this issue 4 years ago • 4 comments

Describe the bug

If you make a table in an {eval-rst} block in an .md document and that table has a cell with an explicit link in it, then that link will incorrectly be rendered as an implicit link (i.e. an anchor) instead of an explicit one.

To Reproduce

```{eval-rst}
+------------------------+------------+----------+
| Header row, column 1   | Header 2   | Header 3 |
+========================+============+==========+
| body row 1, column 1   | column 2   | column 3 |
+------------------------+------------+----------+
| `body row 2`_          | Cells may span        |
+------------------------+-----------------------+

.. _body row 2: https://example.com
```

Expected behavior

"body row 2" is a link to https://example.com

Observed behavior

"body row 2" is a link to #body-row-2

Environment

  • Python Version: 3.8.0
  • Package versions:
    alabaster==0.7.12,attrs==21.2.0,Babel==2.9.1,certifi==2021.5.30,chardet==4.0.0,docutils==0.16,future==0.18.2,idna==2.10,imagesize==1.2.0,Jinja2==3.0.1,markdown-it-py==1.1.0,MarkupSafe==2.0.1,mdit-py-plugins==0.2.8,myst-parser==0.14.0,packaging==20.9,Pygments==2.9.0,pyparsing==2.4.7,pytz==2021.1,PyYAML==5.4.1,requests==2.25.1,snowballstemmer==2.1.0,Sphinx==3.5.4,sphinxcontrib-applehelp==1.0.2,sphinxcontrib-confluencebuilder==1.5.0,sphinxcontrib-devhelp==1.0.2,sphinxcontrib-htmlhelp==2.0.0,sphinxcontrib-jsmath==1.0.1,sphinxcontrib-qthelp==1.0.3,sphinxcontrib-serializinghtml==1.1.5,urllib3==1.26.5
    
  • Operating System: Ubuntu 18.04.5 LTS

tucked avatar Jun 12 '21 00:06 tucked

Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada:

welcome[bot] avatar Jun 12 '21 00:06 welcome[bot]

As a potential workaround, any reason you are not using markdown tables ?

choldgraf avatar Jun 12 '21 01:06 choldgraf

I need multiline cells (for bulleted lists), and I couldn't figure out how to do it in markdown without using raw HTML (which doesn't seem to get the Sphinx style applied).

tucked avatar Jun 12 '21 01:06 tucked

Adding some information to the example at the top:

With this 👇 one can add a table title and label and set column widths.

```{eval-rst}
.. table:: This is a cool table
    :name: tab_cool
    :widths: 50 20 20 20

    +------------------------+------------+----------+----------+
    | Header row, column 1   | Header 2   | Header 3 | Header 4 |
    |                        |            |          |          |
    | (header rows optional) |            |          |          |
    +========================+============+==========+==========+
    | body row 1, column 1   | column 2   | column 3 | column 4 |
    +------------------------+------------+----------+----------+
    | body row 2             | Cells may span columns.          |
    +------------------------+------------+---------------------+
    | body row 3             | Cells may  | - Table cells       |
    +------------------------+            | - contain           |
    | body row 4             | span rows. | - body elements.    |
    +------------------------+------------+---------------------+
```

Note that in contrast to the grid-table documentation I had to add empty lines for the line breaks to end up in my final PDF.

michaelosthege avatar Apr 19 '22 18:04 michaelosthege