Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sphinx-lint incorrectly rejects math directives with line wraps in table cells #123

Open
lpsinger opened this issue Sep 26, 2024 · 3 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@lpsinger
Copy link

lpsinger commented Sep 26, 2024

The following is valid reStructuredText/Sphinx with line-wrapped math directives inside table cells:

Math in Table
=============

+-----------+---------------+---------------+
| Shape     | Area          | Perimeter     |
+===========+===============+===============+
| Circle    | :math:`\pi    | :math:`2 \pi  |
|           | r^2`          | r`            |
+-----------+---------------+---------------+
| Square    | :math:`w^2`   | :math:`4w`    |
+-----------+---------------+---------------+

However, sphinx-lint rejects it with the following error message:

$ sphinx-lint test.rst
test.rst:7: role missing (escaped) space after role: ':math:`\\pi    | :math:`2' (missing-space-after-role)
@hugovk
Copy link
Collaborator

hugovk commented Oct 17, 2024

Thanks for the report.

There's a known issue mentioned on the README:

Currently Sphinx Lint can't work with tables, there's no understanding
of how linesplit works in tables, like:

   +-----------------------------------------+-----------------------------+---------------+
   | Method                                  | Checks that                 | New in        |
   +=========================================+=============================+===============+
   | :meth:`assertEqual(a, b)                | ``a == b``                  |               |
   | <TestCase.assertEqual>`                 |                             |               |
   +-----------------------------------------+-----------------------------+---------------+

as Sphinx Lint works line by line it will inevitably think the :meth: role is not closed properly.

To avoid false positives, some rules are skipped if we're in a table.

It sounds like we need to skip this missing-space-after-role rule inside a table as well?

Would you like to investigate and maybe put together a PR?

@lpsinger
Copy link
Author

I'm sorry, I don't have the bandwidth to open a PR for that right now.

@hugovk hugovk added help wanted Extra attention is needed good first issue Good for newcomers labels Oct 18, 2024
@hugovk
Copy link
Collaborator

hugovk commented Oct 18, 2024

That's fine, we appreciate the report nonetheless :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants