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

"page not found" after using an internal hyperlink #615

Closed
Tenavi opened this issue Sep 2, 2023 · 6 comments
Closed

"page not found" after using an internal hyperlink #615

Tenavi opened this issue Sep 2, 2023 · 6 comments
Labels

Comments

@Tenavi
Copy link

Tenavi commented Sep 2, 2023

Problem Description

If using a hyperlink to something within the package, e.g. [text to display](submodule1.submodule2.submodule3), after clicking on the hyperlink, all links on the linked page return a "page not found" error.

Steps to reproduce the behavior:

  1. Consider a package with this structure:
package
    __init__.py
    submodule1
        __init__.py
       submodule2
            __init__.py
            submodule3
                __init__.py
                ...
  1. Suppose in the submodule1 docstring we want to link package.submodule1.submodule2.submodule3, but we don't want to write the whole thing so we include a hyperlink:
"""
[text to display](submodule1.submodule2.submodule3)
"""
  1. We run pdoc, and click on the hyperlink. pdoc correctly links this to the documentation for submodule3.
  2. All hyperlinks on this page (package/submodule1/submodule2/submodule3.html) lose submodule1/. For example, the "up one level" button tries to link to package/submodule2.html, which doesn't exist so fails.

System Information

pdoc: 14.0.0
Python: 3.8.5
Platform: macOS-10.16-x86_64-i386-64bit
@Tenavi Tenavi added the bug label Sep 2, 2023
@mhils
Copy link
Member

mhils commented Sep 3, 2023

I can't reproduce this. Could you please set up a git repo with a clean reproducer?

@Tenavi
Copy link
Author

Tenavi commented Sep 4, 2023

I can't reproduce this. Could you please set up a git repo with a clean reproducer?

Here's a git repo demonstrating the bug. I have python==3.8.5 in the environment in which the bug was found. Exact instructions are contained in the README and in the documentation generated by using pdoc to document the repo.

https://github.com/Tenavi/pdoc_hyperlink

@mhils
Copy link
Member

mhils commented Sep 6, 2023

Thanks for the excellent reproducer! Manually linking to submodules is unfortunately not supported right now. I've pushed #617 to make sure that the pdoc web server gives you a 404 right away. However, #544 should make it possible to do exactly what you are looking for: You can then use .submodule2.submodule3 (note the leading dot) in your docstrings and things will be automatically linked. :)

@Tenavi
Copy link
Author

Tenavi commented Sep 6, 2023

Ahh I see, thanks for that explanation! I will give that a try.

@mhils
Copy link
Member

mhils commented Sep 10, 2023

Fixed as part of #544 and released in 14.1! :)

@mhils mhils closed this as completed Sep 10, 2023
@Tenavi
Copy link
Author

Tenavi commented Sep 11, 2023

Nice, thanks @mhils !

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

2 participants