hylang / sphinxcontrib-hydomain

Other
4 stars 4 forks source link

API documentation shows parameters without a space #24

Open wrobell opened 1 year ago

wrobell commented 1 year ago

For example I see

(hy.readstreamfilenamereader)

I would, probably, expect

(hy.read stream filename reader)

Screenshot (I hope as raising the issue from a phone :/)

image

Kodiologist commented 1 year ago

Looks okay to me at both https://docs.hylang.org/en/master/api.html#hy.read and https://docs.hylang.org/en/stable/api.html#hy.read in Firefox 108 with mostly default settings:

screenshot

Are you sure this is our bug and not a bug in your web browser? Even if the CSS is wrong, I bet the CSS in question is upstream in the Read the Docs theme or something, and not in this repository.

wrobell commented 1 year ago

I think this might be the problem in conf.py

html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]

I believe this is no longer required, and prevents loading of some of CSS (if I remember well) properly on Webkit based browsers.

scauligi commented 1 year ago

Confirmed on MacOS Safari Version 16.5.2 (18615.2.9.11.10). Commenting out the html_theme_path setting didn't fix it for me either, seems to be some sort of issue with Safari collapsing whitespace (but I don't have time right now to dig into it).

wrobell commented 1 year ago

I can confirm the issue with

It is fine on Firefox indeed.

wrobell commented 1 year ago

BTW. I tried to build documentation locally using Python 11 and Sphinx 7. I get error that sphinxcontrib.hydomain cannot be found. Manually:

>>> import sphinxcontrib.hydomain
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/wrobell/projects/hy/.venv-3.11/lib/python3.11/site-packages/sphinxcontrib/hydomain.py", line 41, in <module>
    from sphinx.pycode.ast import parse as ast_parse
ImportError: cannot import name 'parse' from 'sphinx.pycode.ast' (/home/wrobell/projects/hy/.venv-3.11/lib/python3.11/site-packages/sphinx/pycode/ast.py)

This https://github.com/sphinx-doc/sphinx/pull/11371/files hints to use ast.parse.

Also

Kodiologist commented 1 year ago

Try pip install -r requirements-dev.txt.

wrobell commented 1 year ago

Try pip install -r requirements-dev.txt.

This is what I did, but I gave up seeing Sphinx 5 ;)

Kodiologist commented 1 year ago

But it works. That's how the manual is built currently. Try it if you don't believe me.

wrobell commented 1 year ago

I know, but there is no point dealing with Sphinx 5 to debug the original issue - maybe it is fixed in Sphinx 7.

Kodiologist commented 1 year ago

Maybe, but you may also find it an uphill battle to get sphinxcontrib-hydomain to work with Sphinx 7.

wrobell commented 1 year ago

Maybe, but you may also find it an uphill battle to get sphinxcontrib-hydomain to work with Sphinx 7.

I might try. Any specific example of problems?

Kodiologist commented 1 year ago

I don't remember. I've generally only done the minimum to get sphinxcontrib-hydomain when it breaks.

Kodiologist commented 1 year ago

I can replicate this in Thorium 109, so that seems to confirm this issue is related to WebKit and its descendants. I also find that while hy:autofunction:: hy.read has the spacing issue, autofunction:: hy.read doesn't. I conclude that this is a problem with sphinxcontrib-hydomain.

wrobell commented 1 year ago

BTW. Hyrule uses different theme, and does not suffer from the same problem.