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

Most API reference internal links go to an internal link that skips the top of the page. #451

Open
WarrenWeckesser opened this issue Feb 6, 2022 · 3 comments
Assignees
Labels

Comments

@WarrenWeckesser
Copy link
Member

It looks like most of the internal links within the SciPy API reference page include a link to an id within the page using a # reference that skips the heading of the page. This means information that I would expect to see is not visible unless I scroll up to see the heading.

For example, start at the SciPy API page, and scroll down to the list of the subpackages, and click on the the scipy.signal link. The URL for that link is actually https://scipy.github.io/devdocs/reference/signal.html#module-scipy.signal; note the internal id #module-scipy.signal. Here's a screen shot of that page (using Firefox 96.0.3):

scipy signal

You can see that the top of the heading is clipped. If you remove the #module-scipy.signal id from the URL, you'll see the full heading.

That is a minor nuisance; it is the behavior of the web pages for functions where the problem becomes more signficant. In that scipy.signal page, scroll down and click on, say, filtfilt. The actual URL of the link is https://scipy.github.io/devdocs/reference/generated/scipy.signal.filtfilt.html#scipy.signal.filtfilt; note again the (redundant) reference id #scipy.signal.filtfilt. Here's a screenshot:
scipy signal filtfilt

Most of the signature has been cut off; all we see is the last two parameters, method='pad', irlen=None). If we scroll up, or if we remove #scipy.signal.filtfilt from the URL, we see what we should have seen when we clicked the link:

scipy signal filtfilt2

The docs have had this behavior for a long time. Any chance this can be fixed? Or is this one of those Sphinx quirks that seems like it should be easy to fix, but attempting to do so leads down a rabbit hole of twisty little passages...

(I usually remove the extraneous # id when I include a link in, say, a Stackoverflow comment or answer, to avoid the little bit of confusion that can occur when the page shows a clipped heading.)

@tupui
Copy link
Member

tupui commented Feb 7, 2022

It might be coming from our template. I see a few differences with NumPy and they do not have this issue. I will play around.

@tupui tupui self-assigned this Feb 7, 2022
@tupui tupui added the bug label Feb 7, 2022
@melissawm
Copy link
Contributor

Actually we do. See numpy/numpy#18620 and especially numpy/numpy#18620 (comment)

I think this is a result of how we refer to individual sphinx objects as opposed to pages - but I don't see how we could turn back from our reference style now.

@tupui
Copy link
Member

tupui commented Feb 7, 2022

Ah right I was only thinking about the too long lines issue but not the double reference. As you said @melissawm, could be hard to do. Right now I only see playing with some JS to do this. Maybe worth asking on the theme side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants