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

Cooperate with linkcheck builder #6

Merged
merged 1 commit into from
Jul 12, 2024
Merged

Conversation

jeanas
Copy link
Contributor

@jeanas jeanas commented Nov 5, 2023

Redirect links that direct to an HTTP or HTTPS URL (as opposed to relative links inside the same website) are now passed to the linkcheck builder so that it can do its checking work on them.

This necessitates requiring Sphinx >= 7.1 due to a restructuring of the linkcheck builder code.

Fixes #3


tox passes.

I haven't added tests because it's not clear to me how/if they should be written: if the tests do an actual build with the linkcheck builder, they will be sensitive to network connectivity and external websites, which is probably undesired.

If wanted, this could also be made to work on Sphinx <7.1 with slightly different code.

Redirect links that direct to an HTTP or HTTPS URL (as opposed to
relative links inside the same website) are now passed to the linkcheck
builder so that it can do its checking work on them.

This necessitates requiring Sphinx >= 7.1 due to a restructuring of the
linkcheck builder code.

Fixes documatt#3
@dbast
Copy link

dbast commented Apr 25, 2024

ping... this looks super helpful. anything to be done to get this in?

Copy link
Collaborator

@liborjelinek liborjelinek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A nice job! Thanks and so much sorry for waiting.

@liborjelinek liborjelinek merged commit 1e6a147 into documatt:main Jul 12, 2024
@jeanas jeanas deleted the linkcheck branch July 12, 2024 12:23
@asmeurer
Copy link

asmeurer commented Jul 12, 2024

This is nice, but in practice most redirects are to the same documentation. Does sphinx-reredirects check if these are correct?

@jeanas
Copy link
Contributor Author

jeanas commented Jul 12, 2024

No — this is the limitation mentioned in the documentation added by this PR.

It's been a while since I prepared this, but I seem to recall checking internal links was more difficult.

@asmeurer
Copy link

I think ideally you'd want to check those when the build happens.

@liborjelinek
Copy link
Collaborator

liborjelinek commented Jul 12, 2024

This nice improvement released in v0.1.5. Thanks again @jeanas for this PR.

Yes, @asmeurer, at this moment it checks redirects to external URLs only. Mentioned in the docs https://documatt.com/sphinx-reredirects/usage.html#checking-your-redirects.

I have created #10 for internal link checking. Hopefully, you @asmeurer, @jeanas, or somebody else will help soon.

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

Successfully merging this pull request may close these issues.

[Feature Request] Check external URLs with builtin linkcheck builder
4 participants