jupyter / papyri

MIT License
83 stars 17 forks source link

Rendering of rst tables seems to be missing #91

Open rossbar opened 2 years ago

rossbar commented 2 years ago

This may be a known issue but just something I noticed so I thought I'd mention it here - it looks like rst table syntax is not being properly rendered in the html output. I noticed this while looking at the papyri-generated API docs for numpy.digitize, which has a table in the extended summary of the docstring.

Carreau commented 2 years ago

Yes, and so far I'm relying on tree-sitter-rst, which does not parse tables for rst.

And. my understanding is that detecting and parsing tables is a hell lot complicated, I'm thinking that if there are few enough table I could try to convinces the few use case to migrate to a .. table: directive.

jarrodmillman commented 2 years ago

For the Scientific Python theme, we use yaml for tables. For example,

{{< yamlToTable >}}
headers:
  - Project
  - Available Packages
  - Download location

format:
  - align: left
  - align: left
  - align: right

rows:
  - columns:
      - "NumPy"
      - |
        Official *source code* (all platforms) and *binaries* for<br/>
        **Windows**, **Linux**, and **Mac OS X**
      - "[PyPi page for NumPy](https://pypi.python.org/pypi/numpy)"

  - columns:
      - SciPy
      - |
        Official *source code* (all platforms) and *binaries* for<br/>
        **Windows**, **Linux** and **Mac OS X**
      - |
        [SciPy release page](https://github.com/scipy/scipy/releases) (sources)<br/>
        [PyPI page for SciPy](https://pypi.python.org/pypi/scipy) (all)

{{< /yamlToTable >}}

You can see the rendered version here: https://theme.scientific-python.org/shortcodes/#yamltotable

I suspect something along those lines could work for NetworkX, but I suspect we also want it to work for Sphinx. Not sure how that would work, though.

Carreau commented 2 years ago

I think having a sphinx directive that renders table should not be too complicated as long as we can emit the right docutils nodes.

There is even already a table directive so it should not be a problem.

jarrodmillman commented 2 years ago

It would be nice to have the same format for the hugo theme. We are happy to modify the format (on our end) if it helps.

Carreau commented 2 years ago

Yeas, that should not be a problem in the long run, I'm just likely not going to make it a priority.