-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Ignore anchor and local link #4487
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
although this is not perfect solution for #4209, it can exclude local links and anchors. that i think the improvement to take.
@ros2/team what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm with green CI
Cool! Thanks! |
conf.py
Outdated
linkcheck_ignore = [ | ||
r"^(?!http(|s):\/\/).*", # For ignore local link | ||
] | ||
linkcheck_anchors = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if we should use https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-linkcheck_anchors_ignore_for_url instead. In particular, I that will still check that the URL is valid, it just won't check that the anchor is valid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. So I would use linkcheck_anchors_ignore_for_url
instead for
https://index.ros.org
https://github.com
Thank you so much for the suggestions.
conf.py
Outdated
@@ -176,6 +176,12 @@ | |||
|
|||
sitemap_url_scheme = '{version}/{link}' | |||
|
|||
# -- Options for linkcheck ------------------------------------------------ | |||
linkcheck_ignore = [ | |||
r"^(?!http(|s):\/\/).*", # For ignore local link |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain exactly what we are skipping here? An example of a link that this is skipping would help.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The local link which does not start from https://
or http://
are ignored here.
This is for the link like ../../humble/Installation.htm
which refers to the different distro that didn't build with a particular branch but exists on the published document.
However, this way of implementation ignores all local links and possibly passes the real broken links like #4488.
So to prevent those cases, it is better to add local links one by one manually
linkcheck_ignore = [
r"../../(humble|galactic|etc..)/Installation.htm", # For ignore local link
If you prefer the former, I will modify it accordingly.
Features
Add linkcheck ignore settings
Related
#4209